- Machine Learning with Swift
- Alexander Sosnovshchenko
- 124字
- 2021-06-24 18:55:01
Random forest accuracy evaluation
Loss on training data:
In []: rf_model.score(X_train, y_train) Out[]: 0.98999999999999999
Loss on test data:
In []: rf_model.score(X_test, y_test) Out[]: 0.90333333333333332
Cross-validation:
In []:
scores = cross_val_score(rf_model, features, df.label, cv=10) np.mean(scores) Out[]: 0.89700000000000002 In []: print("Accuracy: %0.2f (+/- %0.2f)" % (scores.mean(), scores.std() * 2)) Accuracy: 0.90 (+/- 0.06)
Precision and recall:
In []: predictions = rf_model.predict(X_test) predictions = np.array(map(lambda x: x == 'rabbosaurus', predictions), dtype='int') true_labels = np.array(map(lambda x: x == 'rabbosaurus', y_test), dtype='int') precision_score(true_labels, predictions) Out[]: 0.9072847682119205 In []: recall_score(true_labels, predictions) Out[]: 0.90131578947368418
F1-score:
In []: f1_score(true_labels, predictions) Out[]: 0.90429042904290435
Confusion matrix:
In []: confusion_matrix(y_test, rf_model.predict(X_test)) Out[]: array([[134, 14], [ 15, 137]])
You export a random forest for the iOS in the same way you do for a decision tree.
推薦閱讀
- Instant uTorrent
- 基于ARM的嵌入式系統(tǒng)和物聯(lián)網(wǎng)開發(fā)
- AMD FPGA設(shè)計(jì)優(yōu)化寶典:面向Vivado/SystemVerilog
- 微服務(wù)分布式架構(gòu)基礎(chǔ)與實(shí)戰(zhàn):基于Spring Boot + Spring Cloud
- The Deep Learning with Keras Workshop
- VMware Workstation:No Experience Necessary
- Managing Data and Media in Microsoft Silverlight 4:A mashup of chapters from Packt's bestselling Silverlight books
- 電腦組裝與維護(hù)即時(shí)通
- 單片微機(jī)原理及應(yīng)用
- 筆記本電腦芯片級(jí)維修從入門到精通(圖解版)
- FreeSWITCH Cookbook
- Angular 6 by Example
- Advanced Machine Learning with R
- Applied Deep Learning with Keras
- INSTANT Cinema 4D Starter