Vitajte na [www.pocitac.win] Pripojiť k domovskej stránke Obľúbené stránky
```
pip install scikit-learn
```
2. Údaje
```
zo sklearn.datasets importovať load_iris
iris =load_iris()
print(iris.data.shape) # (150, 4)
print(iris.target) # [0 0 0 ... 1 1 1]
```
3. Rozdelenie údajov
```
zo 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. Vytvoriť model
```
z importu sklearn.tree DecisionTreeClassifier
clf =DecisionTreeClassifier()
```
5. Školenie
```
clf.fit(X_train, y_train)
```
6. Predpoveď
```
y_pred =clf.predict(X_test)
```
7. Presnosť
```
zo sklearn.metrics importovať presnosť_skóre
skóre =skóre_presnosti(y_test, y_pred)
tlač (skóre) # 0,96
```