Professional Documents
Culture Documents
Lab2 - Jupyter Notebook
Lab2 - Jupyter Notebook
import sklearn
In [13]:
iris = load_iris()
X = iris.data
y = iris.target
In [14]:
Model
In [15]:
clf = DecisionTreeClassifier()
In [16]:
clf.fit(X_train, y_train)
Out[16]:
DecisionTreeClassifier()
In a Jupyter environment, please rerun this cell to show the HTML representation or
trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page
with nbviewer.org.
In [17]:
y_pred = clf.predict(X_test)
localhost:8888/notebooks/Lab2.ipynb 1/2
9/20/23, 11:50 AM Lab2 - Jupyter Notebook
In [18]:
Accuracy: 1.0
In [19]:
In [20]:
In [21]:
dump(clf, 'model.joblib')
loaded_model = load('model.joblib')
In [ ]:
localhost:8888/notebooks/Lab2.ipynb 2/2