@@ -308,6 +308,12 @@ class TSNE(Projector):
308308 is also supported.
309309 callbacks_every_iters : int
310310 How often should the callback be called.
311+ random_state: Optional[Union[int, RandomState]]
312+ The random state parameter follows the convention used in scikit-learn.
313+ If the value is an int, random_state is the seed used by the random
314+ number generator. If the value is a RandomState instance, then it will
315+ be used as the random number generator. If the value is None, the random
316+ number generator is the RandomState instance used by `np.random`.
311317 preprocessors
312318
313319 """
@@ -321,8 +327,9 @@ def __init__(self, n_components=2, perplexity=30, learning_rate=200,
321327 early_exaggeration_iter = 250 , early_exaggeration = 12 ,
322328 n_iter = 750 , exaggeration = None , theta = 0.5 , min_num_intervals = 10 ,
323329 ints_in_interval = 1 , initialization = 'random' , metric = 'euclidean' ,
324- n_jobs = 1 , neighbors = 'exact' , negative_gradient_method = 'bh' , callbacks = None ,
325- callbacks_every_iters = 50 , preprocessors = None ):
330+ n_jobs = 1 , neighbors = 'exact' , negative_gradient_method = 'bh' ,
331+ callbacks = None , callbacks_every_iters = 50 ,
332+ random_state = None , preprocessors = None ):
326333 super ().__init__ (preprocessors = preprocessors )
327334 self .tsne = fastTSNE .TSNE (
328335 n_components = n_components , perplexity = perplexity ,
@@ -333,6 +340,7 @@ def __init__(self, n_components=2, perplexity=30, learning_rate=200,
333340 metric = metric , n_jobs = n_jobs , neighbors = neighbors ,
334341 negative_gradient_method = negative_gradient_method ,
335342 callbacks = callbacks , callbacks_every_iters = callbacks_every_iters ,
343+ random_state = random_state
336344 )
337345
338346 def fit (self , X : np .ndarray , Y : np .ndarray = None ) -> fastTSNE .TSNEEmbedding :
0 commit comments