- Machine Learning with Swift
- Alexander Sosnovshchenko
- 201字
- 2021-06-24 18:55:00
Ensemble learning random forest
One-sentence explanation for LOTR fans: if decision trees were Ents, the random forest would be an Entmoot. For everyone else, random forest algorithm works like this:
- Split data into random subsets of equal size, maybe with replacement
- On each of those subsets, build a decision tree, choosing for every split a random feature subset of fixed size
- To perform inference, perform a voting among the trees (classification), or average their predictions (regression)
Such tree ensembles are very popular in certain domains, because their prediction quality beats most other models.
Most likely, this is not the model you want to train on a mobile device, due to the memory and time limitations, but you can still use it for inference thanks to Core ML. The workflow looks like this:
- Pre-train random forest in scikit-learn
- Export the model in the scikit-learn format
- Convert it to the Apple mlmodel format with the help of the coremltool Python package
- Import it in your iOS project using Core ML framework
By the way, if you look at the inner structure of the GameplayKit's tree learner in a debugger or playground, you'll see that it also uses random forest under the hood.
推薦閱讀
- ATmega16單片機項目驅動教程
- 顯卡維修知識精解
- FPGA從入門到精通(實戰篇)
- scikit-learn:Machine Learning Simplified
- 筆記本電腦維修不是事兒(第2版)
- 電腦高級維修及故障排除實戰
- 無蘋果不生活:OS X Mountain Lion 隨身寶典
- Spring Security 3.x Cookbook
- Arduino項目案例:游戲開發
- 現代多媒體技術及應用
- Exceptional C++:47個C++工程難題、編程問題和解決方案(中文版)
- 超炫的35個Arduino制作項目
- INSTANT Cinema 4D Starter
- Spring Cloud微服務架構開發
- Windows Presentation Foundation 4.5 Cookbook