O
Parameter content random_state (in all functions and methods SciKit-Learn() in reproduced accident values. I mean, if you're clearly pointing. random_state different from None - the pseudent values generated will have the same values at each challenge.Example:In [1]: import numpy as np
In [2]: np.random.seed(31415)
In [3]: np.random.randint(10, size=(5,5))
Out[3]:
array([[7, 3, 5, 8, 2],
[6, 6, 3, 5, 6],
[0, 0, 8, 3, 6],
[1, 6, 8, 5, 1],
[4, 6, 9, 2, 7]])
In [4]: np.random.seed(31415)
In [5]: np.random.randint(10, size=(5,5))
Out[5]:
array([[7, 3, 5, 8, 2],
[6, 6, 3, 5, 6],
[0, 0, 8, 3, 6],
[1, 6, 8, 5, 1],
[4, 6, 9, 2, 7]])
In [6]: np.random.seed(31415)
In [7]: np.random.randint(10, size=(5,5))
Out[7]:
array([[7, 3, 5, 8, 2],
[6, 6, 3, 5, 6],
[0, 0, 8, 3, 6],
[1, 6, 8, 5, 1],
[4, 6, 9, 2, 7]])
PS, if you run this code on your computer, you'll get the same values in the matrices.Why would that be?Machinery training, and not only often use the pseudent cell generator to initiate different parameters, neuronet weights, random separation of the net date on the learning and check grid.Accordingly, if we want to compare a few methods or different sets of parameters, the same training and checking nets should be used to be honestly compared.It is also useful to create data sets in an accidental but reproducible way. For example, you have set up several different computing methods and you want to compare them or verify the correctness - the same entry data should be used.UPD: If you ask the same meaning random_statethe same input data result t-SNE It will be the same:In [120]: from sklearn.manifold import TSNE
In [121]: a = np.random.rand(1000, 50)
In [122]: res1 = TSNE(n_components=2, random_state=123).fit_transform(a)
In [123]: res2 = TSNE(n_components=2, random_state=123).fit_transform(a)
In [124]: res1.sum()
Out[124]: -205.98636
In [125]: res2.sum()
Out[125]: -205.98636
In [126]: res1 == res2
Out[126]:
array([[ True, True],
[ True, True],
[ True, True],
...,
[ True, True],
[ True, True],
[ True, True]])
In [127]: (res1 == res2).all()
Out[127]: True