-
-
Save siddharthganjoo/306a60c9775cb08bafc3e0e3adaf01c0 to your computer and use it in GitHub Desktop.
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
#train test split | |
from sklearn.model_selection import train_test_split | |
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.3,stratify=y, random_state = 42) | |
from sklearn.preprocessing import StandardScaler | |
sc = StandardScaler() | |
x_train = sc.fit_transform(x_train) | |
x_test = sc.transform(x_test) | |
# convert the data to categorical labels | |
from tensorflow.keras.utils import to_categorical | |
y_train = to_categorical(y_train, num_classes=None) | |
y_test = to_categorical(y_test, num_classes=None) | |
print (y_train.shape) | |
#printing the shape of train data | |
x_train.shape |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment