Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sf_crime_7.py
# with the street probabilities, we can now assign them to each sample.
# as mentioned before, samples on street corners receive the mean of each street probability.
def assign_street_probabilities(address, probabilities):
return np.mean([
probabilities[clean_road(road)]
for road in address.split(" / ")
])
train["RoadProba"] = train["Address"].map(partial(assign_street_probabilities, probabilities=log_probas))
train.drop("Address", axis=1, inplace=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment