Created
November 13, 2017 08:40
-
-
Save dyerrington/35ec6dd854226e9c8d6d1877626aacce to your computer and use it in GitHub Desktop.
Extremely terse example using out of context lastfm artist dataset. If you're interested in the full example, I will update this if you message me directly or comment here.
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
from sklearn.neighbors import NearestNeighbors | |
nn = NearestNeighbors(n_neighbors=150, radius=10) | |
model = nn.fit(artist_genre) | |
A = model.radius_neighbors_graph(artist_genre) | |
artist_neighbors = pd.DataFrame(A.toarray(), columns=artist_sim.index, index=artist_sim.index) | |
artist_neighbors['2Pac'].sort_values(ascending=False).head(150) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment