Skip to content

Instantly share code, notes, and snippets.

@fedden
Created November 20, 2017 12:03
Show Gist options
  • Save fedden/32a69dfa7185ac6c446b8e58e5122c68 to your computer and use it in GitHub Desktop.
Save fedden/32a69dfa7185ac6c446b8e58e5122c68 to your computer and use it in GitHub Desktop.
import umap
from sklearn.preprocessing import MinMaxScaler
def get_scaled_umap_embeddings(features, neighbour, distance):
embedding = umap.UMAP(n_neighbors=neighbour,
min_dist=distance,
metric='correlation').fit_transform(features)
scaler = MinMaxScaler()
scaler.fit(embedding)
return scaler.transform(embedding)
umap_embeddings_mfccs = []
umap_embeddings_wavenet = []
neighbours = [5, 10, 15, 30, 50]
distances = [0.000, 0.001, 0.01, 0.1, 0.5]
for neighbour in neighbours:
for distance in distances:
umap_mfccs = get_scaled_umap_embeddings(mfcc_features,
neighbour,
distance)
umap_wavenet = get_scaled_umap_embeddings(wavenet_features,
neighbour,
distance)
@puterd
Copy link

puterd commented Jan 9, 2018

Hey I get an error here: AttributeError: module 'umap' has no attribute 'UMAP'.. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment