Created
October 30, 2020 00:16
-
-
Save aagnone3/23328d32bb283b49703405fe97497447 to your computer and use it in GitHub Desktop.
sf_crime_7.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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