Created
November 12, 2020 12:40
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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