TSNE size & title bug
See original GitHub issueDescribe the bug
Looks like our TSNEVisualizer
might have a bug that causes an error on instantiation if either the size
or title
parameters are used.
To Reproduce
from yellowbrick.text import TSNEVisualizer
from sklearn.feature_extraction.text import TfidfVectorizer
corpus = load_data('hobbies')
tfidf = TfidfVectorizer()
docs = tfidf.fit_transform(corpus.data)
labels = corpus.target
tsne = TSNEVisualizer(size=(1080, 720))
or
tsne = TSNEVisualizer(title="My Special TSNE Visualizer")
Dataset This bug was triggered using the YB hobbies corpus.
Expected behavior
Users should be able to influence the size of the visualizer on instantiation using the size
parameter and a tuple with (width, height)
in pixels, and the title of the visualizer using the title
parameter and a string.
Traceback
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-120fbfcec07c> in <module>()
----> 1 tsne = TSNEVisualizer(size=(1080, 720))
2 tsne.fit(labels)
3 tsne.poof()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/yellowbrick/text/tsne.py in __init__(self, ax, decompose, decompose_by, labels, classes, colors, colormap, random_state, **kwargs)
180
181 # TSNE Parameters
--> 182 self.transformer_ = self.make_transformer(decompose, decompose_by, kwargs)
183
184 def make_transformer(self, decompose='svd', decompose_by=50, tsne_kwargs={}):
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/yellowbrick/text/tsne.py in make_transformer(self, decompose, decompose_by, tsne_kwargs)
234 # Add the TSNE manifold
235 steps.append(('tsne', TSNE(
--> 236 n_components=2, random_state=self.random_state, **tsne_kwargs)))
237
238 # return the pipeline
TypeError: __init__() got an unexpected keyword argument 'size'
or for title
:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-64-92c88e0bdd33> in <module>()
----> 1 tsne = TSNEVisualizer(title="My Special TSNE Visualizer")
2 tsne.fit(labels)
3 tsne.poof()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/yellowbrick/text/tsne.py in __init__(self, ax, decompose, decompose_by, labels, classes, colors, colormap, random_state, **kwargs)
180
181 # TSNE Parameters
--> 182 self.transformer_ = self.make_transformer(decompose, decompose_by, kwargs)
183
184 def make_transformer(self, decompose='svd', decompose_by=50, tsne_kwargs={}):
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/yellowbrick/text/tsne.py in make_transformer(self, decompose, decompose_by, tsne_kwargs)
234 # Add the TSNE manifold
235 steps.append(('tsne', TSNE(
--> 236 n_components=2, random_state=self.random_state, **tsne_kwargs)))
237
238 # return the pipeline
TypeError: __init__() got an unexpected keyword argument 'title'
Desktop (please complete the following information):
- macOS
- Python Version 3.6
- Yellowbrick Version 0.8
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Using T-SNE in Python to Visualize High-Dimensional Data Sets
T-distributed neighbor embedding (t-SNE) is a dimensionality reduction technique that helps users visualize high-dimensional data sets. It ...
Read more >tsne Settings - MATLAB & Simulink
Use PCA to reduce the initial dimensions from 784 to 50. t-SNE creates a figure with well separated clusters and relatively few data...
Read more >t-SNE: T-Distributed Stochastic Neighbor Embedding Explained
Larger datasets usually require a larger perplexity. Consider selecting a value between 5 and 50.
Read more >Auxiliary tutorial 8: t-SNE - BE/Bi 103
There is a mysterious and heretofore unsolved bug, where scikit-learn.manifold.tsne.fit_transform() returns the error " array must not contain infs or NaNs ...
Read more >tsne: T-Distributed Stochastic Neighbor Embedding for R (t-SNE)
Title T-Distributed Stochastic Neighbor Embedding for R (t-SNE). Version 0.1-3.1 ... BugReports https://github.com/jdonaldson/rtsne/issues.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @danielhoadley and thanks for checking out Scikit-Yellowbrick! You’re right that the change isn’t in v0.8 yet, but we’ve made the fix, and it will be reflected in v0.9, which we should be releasing in just a few weeks!
Thanks, @rebeccabilbro! It’s a great library!