Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created November 12, 2020 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuyasugano/01101ec93dc8d6c6a137ee368372abf6 to your computer and use it in GitHub Desktop.
Save yuyasugano/01101ec93dc8d6c6a137ee368372abf6 to your computer and use it in GitHub Desktop.
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