Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn import ensemble, datasets
- from sklearn.externals import joblib
- iris = datasets.load_iris()
- X, y = iris.data, iris.target
- clf = ensemble.RandomForestClassifier()
- clf.fit(X, y)
- joblib.dump(clf, 'rf-model.pkl')
- from sklearn.externals import joblib
- clf = joblib.load('rf-model.pkl')
- clf.predict(Xnew)
- int32_t digits_predict_tree_0(int32_t *features, int32_t features_length)
- {
- if (features[36] < 32768) {
- if (features[57] < 65536) {
- return 9;
- } else {
- if (features[10] < 950272) {
- return 5;
- ....
- }
- int32_t digits_predict(int32_t *fe, int32_t features_length)
- {
- _class = digits_predict_tree_1(fe, length); votes[_class] += 1;
- _class = digits_predict_tree_2(fe, length); votes[_class] += 1;
- ....
- return find_majority(votes);
- }
Add Comment
Please, Sign In to add comment