1. Installasjon
```
pip installer scikit-learn
```
2. Data
```
fra sklearn.datasets import load_iris
iris =load_iris()
print(iris.data.shape) # (150, 4)
print(iris.target) # [0 0 0 ... 1 1 1]
```
3. Splitte data
```
fra sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test =train_test_split(iris.data, iris.target, test_size=0.25)
```
4. Opprett modell
```
fra sklearn.tree import DecisionTreeClassifier
clf =DecisionTreeClassifier()
```
5. Trening
```
clf.fit(X_train, y_train)
```
6. Forutsigelse
```
y_pred =clf.predict(X_test)
```
7. Nøyaktighet
```
fra sklearn.metrics import accuracy_score
score =nøyaktighetsscore(y_test, y_pred)
print(score) # 0,96
```