-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
There are no files selected for viewing
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
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) |