Skip to content

Commit 0e57689

Browse files
committed
The parameter init="pca" cannot be used with metric="precomputed".
ValueError: The parameter init="pca" cannot be used with metric="precomputed". Changed in version 1.2: The default value changed to "pca". model = TSNE(n_components=2, random_state=0, metric='precomputed', perplexity=min(len(dist_matrix) - 1, 30), **kwargs) add back what was the default param initially: init='random' See also scikit-learn/scikit-learn#18018
1 parent 8d855d6 commit 0e57689

File tree

3 files changed

+284
-671
lines changed

3 files changed

+284
-671
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ History
99
* Adding testing for Python 3.10, 3.11, move default version to Python 3.10.
1010
* Tox testing: No module named 'sklearn.manifold'; 'sklearn' is not a package.
1111
* Rename sklearn.py to lda_model.py.
12+
* ValueError: The parameter init="pca" cannot be used with metric="precomputed".
1213
* Update sklearn.py #239.
1314
* fixes error of get_feature_names removal #235.
1415
* Remove "sklearn" from requirements #234

notebooks/LDA model.ipynb

Lines changed: 282 additions & 670 deletions
Large diffs are not rendered by default.

pyLDAvis/_prepare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def js_TSNE(distributions, **kwargs):
158158
tsne : array, shape (`n_dists`, 2)
159159
"""
160160
dist_matrix = squareform(pdist(distributions, metric=_jensen_shannon))
161-
model = TSNE(n_components=2, random_state=0, metric='precomputed',
161+
model = TSNE(n_components=2, random_state=0, metric='precomputed', init='random',
162162
perplexity=min(len(dist_matrix) - 1, 30), **kwargs)
163163
return model.fit_transform(dist_matrix)
164164

0 commit comments

Comments
 (0)