turicreate.toolkits.distances.build_address_distance(number=None, street=None, city=None, state=None, zip_code=None)

Construct a composite distance appropriate for matching address data. NOTE: this utility function does not guarantee that the output composite distance will work with a particular dataset and model. When the composite distance is applied in a particular context, the feature types and individual distance functions must be appropriate for the given model.

number, street, city, state, zip_code : string, optional

Name of the SFrame column for the feature corresponding to the address component. Each feature name is mapped to an appropriate distance function and scalar multiplier.

dist : list

A composite distance function, mapping sets of feature names to distance functions.


>>> homes = turicreate.SFrame({'sqft': [1230, 875, 1745],
...                          'street': ['phinney', 'fairview', 'cottage'],
...                          'city': ['seattle', 'olympia', 'boston'],
...                          'state': ['WA', 'WA', 'MA']})
>>> my_dist = turicreate.distances.build_address_distance(street='street',
...                                                     city='city',
...                                                     state='state')
>>> my_dist
[[['street'], 'jaccard', 5],
 [['state'], 'jaccard', 5],
 [['city'], 'levenshtein', 1]]