black box machine learning
- 1 minutes read - 88 wordsDuring my Ph.D. I studied optimization algorithms. Optimization algorithms are typically an integral part of machine learning algorithms, and we discussed many machine learning algorithms, but somehow I made it through without doing very much actual machine learning training or prediction tasks.
It turns out that it isn’t very hard to do some very basic machine learning:
pip install -U numpy scipy scikit-learn
ipython
from sklearn.ensemble import RandomForestClassifier
from sklearn import datasets
iris_data = datasets.load_iris()
rfc = RandomForestClassifier()
rfc.fit(iris_data['data'], iris_data['target'])
rfc.predict([6.1,2.6,5.6,1.4]) # yields array([2])
rfc.predict([5.7,4.4,1.5,0.4]) # yields array([0])