module mlmodel.predictable_tsne
¶
Classes¶
class 
truncated documentation 

tSNE is an interesting transform which can only be used to study data as there is no way to reproduce the … 
Methods¶
method 
truncated documentation 

Trains a TSNE then trains an estimator to approximate its outputs. Parameters ——— … 

Runs the predictions. Parameters ——— X : numpy array or sparse matrix of shape [n_samples,n_features] … 
Documentation¶
Implements a predicatable tSNE.

class
mlinsights.mlmodel.predictable_tsne.
PredictableTSNE
(normalizer=None, transformer=None, estimator=None, normalize=True, keep_tsne_outputs=False)[source]¶ Bases:
sklearn.base.BaseEstimator
,sklearn.base.TransformerMixin
tSNE is an interesting transform which can only be used to study data as there is no way to reproduce the result once it was fitted. That’s why the class TSNE does not have any method transform, only fit_transform. This example proposes a way to train a machine learned model which approximates the outputs of a TSNE transformer. Notebooks Predictable tSNE gives an example on how to use this class.
 Parameters
normalizer – None by default
transformer – sklearn.manifold.TSNE by default
estimator – sklearn.neural_network.MLPRegressor by default
normalize – normalizes the outputs, centers and normalizes the output of the tSNE and applies that same normalization to he prediction of the estimator
keep_tsne_output – if True, keep raw outputs of TSNE is stored in member tsne_outputs_

__init__
(normalizer=None, transformer=None, estimator=None, normalize=True, keep_tsne_outputs=False)[source]¶  Parameters
normalizer – None by default
transformer – sklearn.manifold.TSNE by default
estimator – sklearn.neural_network.MLPRegressor by default
normalize – normalizes the outputs, centers and normalizes the output of the tSNE and applies that same normalization to he prediction of the estimator
keep_tsne_output – if True, keep raw outputs of TSNE is stored in member tsne_outputs_

fit
(X, y, sample_weight=None)[source]¶ Trains a TSNE then trains an estimator to approximate its outputs.
 Parameters
X (numpy array or sparse matrix of shape [n_samples,n_features]) – Training data
y (numpy array of shape [n_samples, n_targets]) – Target values. Will be cast to X’s dtype if necessary
sample_weight (numpy array of shape [n_samples]) – Individual weights for each sample
 Returns
self
 Return type
returns an instance of self.

normalizer_
¶  Type
trained normalier

transformer_
¶  Type
trained transformeer

estimator_
¶  Type
trained regressor

tsne_outputs_
¶  Type
tSNE outputs if keep_tsne_outputs is True

mean_
¶  Type
average of the tSNE output on each dimension

inv_std_
¶ output on each dimension
 Type
inverse of the standard deviation of the tSNE

loss_
¶ and the outputs of tSNE
 Type
loss (sklearn.metrics.mean_squared_error) between the predictions