Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created November 12, 2020 12:40
Embed
What would you like to do?
What are standarization and normalization? Test with iris data set in Scikit-learn
from sklearn.model_selection import train_test_split
def decision_boundary(df, clf, ax):
X = df.iloc[:, [0, 2]]
y = df['target']
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=39)
clf.fit(X_train, y_train)
print('Classifier: {}'.format(clf))
print('Test set score: {:.2f}'.format(clf.score(X_test, y_test)))
ret = X.to_numpy()
mglearn.plots.plot_2d_separator(clf, ret, fill=True, eps=0.5, ax=ax, alpha=.4)
mglearn.discrete_scatter(ret[:, 0], ret[:, 1], y.to_numpy(), ax=ax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment