alok-ai-lab / pyDeepInsight

A python implementation of the DeepInsight methodology.
GNU General Public License v3.0
158 stars 47 forks source link

[PyTorch] Add Perplexity Parameter to TSNE #4

Closed heitorrapela closed 3 years ago

heitorrapela commented 3 years ago

Vary the perplexity parameter in TSNE is essential to have an useful image. For many problems the default value of the perplexity is not useful.

kaboroevich commented 3 years ago

This can already be accomplished by passing a sklearn.manifold.TSNE instance with the preferred defined parameters to the feature_extractor parameter of ImageTransformer. I am hesitant to add method specific parameters for the string feature_extractor options as there are many (tnse.metric, kernelpca.kernel, etc.). If anything, I plan to deprecate the use of strings for the feature_extractor parameter and allow only class instances - the use of a select set of strings initially added to keep the interface similar to the MatLab implementation.

from pyDeepInsight import ImageTransformer
from sklearn.manifold import TSNE

custom_tsne = TSNE(n_components=2, perplexity=30.0, metric='cosine')
it = ImageTransformer(feature_extractor=custom_tsne, pixels=50)
heitorrapela commented 3 years ago

I see, thanks for the information about the passing the feature_extractor it is really useful. I will close the PR. Best regards,