felipekitamura commited on
Commit
3eaacbe
·
verified ·
1 Parent(s): 6aa5b29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -14,7 +14,7 @@ def reduce_dimensions(data, method='PCA'):
14
  if method == 'PCA':
15
  model = PCA(n_components=2)
16
  elif method == 'TSNE':
17
- model = TSNE(n_components=2, learning_rate='auto', init='random', perplexity=3)
18
  return model.fit_transform(data)
19
 
20
  # Plotting function
@@ -74,9 +74,9 @@ def inference(word1, word2, word3):
74
  data = np.concatenate([x[np.newaxis, :] for x in words.values()], axis=0)
75
  print(data.shape)
76
  labels = words.keys()
77
- reduced_data_pca = reduce_dimensions(data, method='PCA')
78
  print(reduced_data_pca.shape)
79
- plot_reduced_data(reduced_data_pca, labels, 'PCA Results')
80
  return cache
81
 
82
  examples = [
 
14
  if method == 'PCA':
15
  model = PCA(n_components=2)
16
  elif method == 'TSNE':
17
+ model = TSNE(n_components=2, learning_rate='auto', init='random', perplexity=4)
18
  return model.fit_transform(data)
19
 
20
  # Plotting function
 
74
  data = np.concatenate([x[np.newaxis, :] for x in words.values()], axis=0)
75
  print(data.shape)
76
  labels = words.keys()
77
+ reduced_data_pca = reduce_dimensions(data, method='TSNE')
78
  print(reduced_data_pca.shape)
79
+ plot_reduced_data(reduced_data_pca, labels, 'TSNE Results')
80
  return cache
81
 
82
  examples = [