Python
144
Вклад в тег
clf = RandomForestClassifier(n_jobs=-1)
clf.fit(X_train, y_train)
predict = clf.predict(tfidf_predict.toarray())
>>> import random
>>> ['%.2f' % random.random() for i in range(10)]
['0.21', '0.66', '0.18', '0.48', '0.86', '0.46', '0.48', '0.04', '0.67', '0.37']
>>>
>>> ['%.2f' % random.random() for i in range(10)]
['0.90', '0.68', '0.02', '0.90', '0.63', '0.06', '0.22', '0.14', '0.97', '0.68']
>>>
>>> random.seed(5)
>>> ['%.2f' % random.random() for i in range(10)]
['0.62', '0.74', '0.80', '0.94', '0.74', '0.92', '0.03', '0.47', '0.94', '0.65']
>>>
>>> random.seed(5)
>>> ['%.2f' % random.random() for i in range(10)]
['0.62', '0.74', '0.80', '0.94', '0.74', '0.92', '0.03', '0.47', '0.94', '0.65']