Skip to content

Instantly share code, notes, and snippets.

@shepai
Created January 7, 2022 11:47
Show Gist options
  • Select an option

  • Save shepai/4e1ca5c973de958e9fbecc3d0ec58d03 to your computer and use it in GitHub Desktop.

Select an option

Save shepai/4e1ca5c973de958e9fbecc3d0ec58d03 to your computer and use it in GitHub Desktop.
Standardized data
"""
Normalize datasets
"""
#perform preprocessing scaling of the data
toTrain=train_X.reshape(len(train_X),28*28)
toTest=test_X.reshape(len(test_X),28*28)
scaler1 = preprocessing.StandardScaler().fit(toTrain)
X_standard_train = scaler1.transform(toTrain)
scaler2 = preprocessing.StandardScaler().fit(toTest)
X_standard_test = scaler2.transform(toTest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment