Skip to content

Instantly share code, notes, and snippets.

@Mehdi-Amine
Last active April 21, 2020 16:31
Show Gist options
  • Save Mehdi-Amine/f19234372b93f1aa486bd79aa2f68eb0 to your computer and use it in GitHub Desktop.
Save Mehdi-Amine/f19234372b93f1aa486bd79aa2f68eb0 to your computer and use it in GitHub Desktop.
from sklearn.preprocessing import StandardScaler
std_scaler = StandardScaler()
dx_train_standardized_sklearn = std_scaler.fit_transform(dx_train)
# Printing the first 5 rows
print(f"Training data standardized using Scikit-Learn: \n{dx_train_standardized_sklearn[:5]}")
'''
Out:
Training data standardized using Scikit-Learn:
[[-0.55691098 1.55759807]
[ 0.80869448 0.06826127]
[-0.38621029 1.72307993]
[-0.55691098 1.3921162 ]
[ 0.12589175 0.06826127]]
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment