Guest User

Untitled

a guest
May 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. from sklearn import ensemble, datasets
  2. from sklearn.externals import joblib
  3. iris = datasets.load_iris()
  4. X, y = iris.data, iris.target
  5. clf = ensemble.RandomForestClassifier()
  6. clf.fit(X, y)
  7. joblib.dump(clf, 'rf-model.pkl')
  8.  
  9. from sklearn.externals import joblib
  10. clf = joblib.load('rf-model.pkl')
  11. clf.predict(Xnew)
  12.  
  13. int32_t digits_predict_tree_0(int32_t *features, int32_t features_length)
  14. {
  15. if (features[36] < 32768) {
  16. if (features[57] < 65536) {
  17. return 9;
  18. } else {
  19. if (features[10] < 950272) {
  20. return 5;
  21. ....
  22. }
  23.  
  24. int32_t digits_predict(int32_t *fe, int32_t features_length)
  25. {
  26. _class = digits_predict_tree_1(fe, length); votes[_class] += 1;
  27. _class = digits_predict_tree_2(fe, length); votes[_class] += 1;
  28. ....
  29. return find_majority(votes);
  30. }
Add Comment
Please, Sign In to add comment