fit and transform the train set and apply to test set

PHOTO EMBED

Fri Jan 14 2022 14:40:01 GMT+0000 (Coordinated Universal Time)

Saved by @peternijhuis #python #scaling #prediction

...
# define the scaler
scaler = MinMaxScaler()
# fit on the training dataset
scaler.fit(X_train)
# scale the training dataset
X_train = scaler.transform(X_train)
# scale the test dataset
X_test = scaler.transform(X_test)
content_copyCOPY