Skip to content

Instantly share code, notes, and snippets.

@codeperfectplus
Last active May 25, 2020 15:33
Show Gist options
  • Save codeperfectplus/1a04f8046e72a920c71f2d60bfefd92a to your computer and use it in GitHub Desktop.
Save codeperfectplus/1a04f8046e72a920c71f2d60bfefd92a to your computer and use it in GitHub Desktop.
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix
iris = load_iris()
X = iris.data
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=24)
clf = LogisticRegression().fit(X_train, y_train)
y_predict = clf.predict(X_test)
cMatrix = confusion_matrix(y_test, y_predict)
print(cMatrix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment