view test-data/scikit-script.py @ 1:c93b2676a27d draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/jupyter_job commit 6817ef65c64c0800e21815822c38beba52075f75"
author bgruening
date Sun, 20 Feb 2022 15:43:37 +0000
parents f4619200cb0a
children
line wrap: on
line source

# Train a model.
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split

iris = load_iris()
X, y = iris.data, iris.target
X, y = X[:20], y[:20]
loss = list()
X_train, X_test, y_train, y_test = train_test_split(X, y)
clr = RandomForestClassifier(n_estimators=5)
clr.fit(X_train, y_train)
clr.score(X_test, y_test)