Skip to content

Commit

Permalink
[Book] Add scikit test
Browse files Browse the repository at this point in the history
Type : fix.

Abstract:
* Add scikit test
  • Loading branch information
JackFunfia committed Jun 1, 2023
1 parent bee7e00 commit 7bb6d90
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ch03/scikit_learb_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import numpy as np

iris = datasets.load_iris()
X = iris.data[:, [2, 3]]
y = iris.target
print(f"Class labels : {np.unique(y)}")

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1, stratify=y)

sc = StandardScaler()
sc.fit(X_train)
X_train_std = sc.transform(X_train)
X_test_std = sc.transform(X_test)

0 comments on commit 7bb6d90

Please sign in to comment.