How To Standardise Features In Python? - ProjectPro
Maybe your like
Recipe Objective
It is very rare to find a raw dataset which perfectly follows certain specific distribution. Usually every dataset needs to be standarize by any means.
So this is the recipe on how we can standardise features in Python.
Master the Art of Data Cleaning in Machine Learning
Table of Contents
- Recipe Objective
- Step 1 - Import the library
- Step 2 - Setting up the Data
- Step 3 - Using StandardScaler
Step 1 - Import the library
from sklearn import preprocessing import numpy as np
We have only imported numpy and preprocessing which is needed.
Step 2 - Setting up the Data
We have created an numpy array with different values. x = np.array([[-500.5], [-100.1], [0], [100.1], [900.9]])
Step 3 - Using StandardScaler
StandardScaler is used to remove the outliners and scale the data by making the mean of the data 0 and standard deviation as 1. So we are creating an object scaler to use standardScaler. We have fitted the fit data and transformed train and test data form standard scaler. Finally we have printed the dataset. scaler = preprocessing.StandardScaler() standardized_x = scaler.fit_transform(x) print(x) print(standardized_x) As an output we get
[[-500.5] [-100.1] [ 0. ] [ 100.1] [ 900.9]] [[-1.26687088] [-0.39316683] [-0.17474081] [ 0.0436852 ] [ 1.79109332]]Tag » How To Standardize Data In Python
-
2 Easy Ways To Standardize Data In Python For Machine Learning
-
How To Standardize Data In Python - Python-bloggers
-
How And Why To Standardize Your Data: A Python Tutorial
-
2 Easy Ways To Normalize Data In Python - DigitalOcean
-
6.3. Preprocessing Data — Scikit-learn 1.1.2 Documentation
-
How To Standardize Data In Python (With Examples) - - Statology
-
How To Standardize Data In A Pandas DataFrame? - GeeksforGeeks
-
How To Use StandardScaler And MinMaxScaler Transforms In Python
-
How To Standardize Your Data ? [Data Standardization With Python]
-
Standardizing Data | Python - DataCamp
-
Standardizing Data | Python - DataCamp
-
Machine-learning-articles/how-to-normalize-or-standardize ... - GitHub
-
Data Normalization In Python
-
How To Standardize Data Using Z-Score/Standard Scalar | Python