SlideShare a Scribd company logo
Lesson 5
Scaling and Normalization Kush Kulshrestha
Topics
1. Scaling of Data
2. Data Normalization
3. Difference between Scaling and Normalization
4. Min-max scalar and Box-Cox Transformation
Scaling of data
• Variable scaling requires taking values that span a specific range and representing them in another range.
• The standard method is to scale variables to [0,1].
• This may introduce various distortions or biases into the data but the distribution or shape remains same.
• Depending on the modeling tool, scaling variable ranges can be beneficial or sometimes even required.
One way of doing this is:
Linear Scaling Transform
• First task in this scaling is to determine the minimum and maximum values of variables.
• Then applying the transform:
(x - min{x1, xN}) / (max{x1, xN} - min{x1, xN})
• This introduces no distortion to the variable distribution.
• Has a one-to-one relationship between the original and scaled values.
Scaling of data
Out of Range values
• In data preparation, the data used is only a sample of the population.
• Therefore, it is not certain that the actual minimum and maximum values of the variable have been
discovered when scaling the ranges.
• If some values that turn up later in the mining process are outside of the limits discovered in the sample,
they are called out-of-range values.
Scaling of data
Dealing with Out of Range values
• After range scaling, all variables should be in the range of [0,1].
• Out-of-range values, however, have values like -0.2 or 1.1 which can cause unwanted behavior.
Solution 1: Ignore that the range has been exceeded.
• Most modeling tools have (at least) some capacity to handle numbers outside the scaling range.
• Important question to ask: Does this affect the quality of the model?
Solution 2: Exclude the out of range instances.
• One problem is that reducing the number of instances reduces the confidence that the sample represents
the population.
• Another problem: Introduction of bias. Out-of-range values may occur with a certain pattern and ignoring
these instances removes samples according to a pattern introducing distortion to the sample
Scaling of data
Dealing with Out of Range values
Solution 3: Clip the out of range values
• If the value is greater than 1, assign 1 to it. If less than 0, assign 0.
• This approach assumes that out-of-range values are somehow equivalent with range limit values.
• Therefore, the information content on the limits is distorted by projecting multiple values into a single
value.
• This also introduces some bias.
Solution 4: Making room for out of range values
• The linear scaling transform provides an undistorted normalization but suffers from out-of-range values.
• Therefore, we should modify it to somehow include also values that are out of range.
• Most of the population is inside the range so for these values the normalization should be linear.
• The solution is to reserve some part of the range for the out-of-range values.
• Reserved amount of space depends on the confidence level of the sample:
e.g. - 98% confidence linear part is [0.01, 0.99]
Scaling of data
Dealing with Out of Range values
Squashing the out of range values
• Now the problem reduces to fitting the out-of-range values into the space left for them.
• The greater the difference between a value and the range limit, the less likely any such value is found.
• Therefore, the transformation should be such that as the distance to the range grows, the smaller the
increase towards one or decrease towards zero.
• One possibility is to use functions of the form y =1/x and attach them to the ends of the linear part.
Its difficult to carry out the scaling in pieces depending on the nature of the data point.
We can do all of the above steps using one function called Softmax scaling.
Scaling of data
Dealing with Out of Range values
Softmax Scaling –
• The extent of the linear part can be controlled by one parameter.
• The space assigned for out-of-range values can be controlled by the level of uncertainty in the sample.
• Non identical values have always different normalized values.
Softmax scaling is based on the logistic function:
y = 1 / (1 + e-x)
Where y is the scaled value and x is the input value.
• The logistic function transforms the original range of
[-,] to [0,1] and also has a linear part on the transform.
Scaling of data
Min-Max Scaler In scikit-learn
Data Normalization
• Applying a function to each data point z in the data: yi = f(zi)
• Unlike scaling, not only the data is distorted, but the shape or distribution of the data changes as well.
• The point of normalization is to change your observations so that they can be described as a normal
distribution.
• In general, you'll only want to normalize your data if you're going to be using a machine learning or
statistics technique that assumes your data is normally distributed.
• Or before using any technique containing “Gaussian” in its name.
Data Normalization
Data Standardization
• Also called z-scores.
• The terms normalization and standardization are
sometimes used interchangeably.
• Standardization transforms data to have a mean of
zero and a standard deviation of 1.
• Done by subtracting the mean and dividing by the
standard deviation for each data point.
Data Normalization
Log Transformation
• The log transformation can be used to make highly skewed distributions less skewed.
• This can be valuable both for making patterns in the data more interpretable and for helping to meet the
assumptions of inferential statistics.
• Figure shows an example of how a log transformation can make patterns more visible. Both graphs plot
the brain weight of animals as a function of their body weight. The raw weights are shown in the left
panel; the log-transformed weights are plotted in the right panel.
Data Normalization
Box-Cox Transformation
The Box-Cox transformation of the variable x is also indexed by λ, and is defined as:
• Box-Cox transformations cannot handle negative values.
• One way to deal with this is by adding the minimum data point value to add the data points.
• We want to use the same lambda generated from the training set of box cox transformation in the test
set.
• Another way to write this equation:
as ƛ turns to be 0
Data Normalization
Box-Cox Transformation
Notice with this definition of that x = 1 always maps to the point = 0 for all values of λ. To see how
the transformation works, look at the examples in Figure.
Data Normalization
Box-Cox Transformation
In the top row, the choice λ = 1 simply shifts x to the value x−1, which is a straight line. In the bottom row (on
a semi-logarithmic scale), the choice λ = 0 corresponds to a logarithmic transformation, which is now a
straight line. We superimpose a larger collection of transformations on a semi-logarithmic scale in Figure 2.
Data Normalization
Box-Cox Transformation
Data Normalization
Why do we need normalization?
1. Some algorithms need normally distributed data as input, otherwise the results are not reliable.
2. Easy comparison of values.
3. Interpretation of results makes more sense.
4. Objective function works faster in some cases if the data is normalized, i.e., speed of the algorithm
increases.
5. Can create complex features that may improve the model (or make it non-linear)

More Related Content

What's hot

Linear regression
Linear regressionLinear regression
Linear regression
MartinHogg9
 
Recurrent neural networks rnn
Recurrent neural networks   rnnRecurrent neural networks   rnn
Recurrent neural networks rnn
Kuppusamy P
 
Data preprocessing in Data Mining
Data preprocessing in Data MiningData preprocessing in Data Mining
Data preprocessing in Data Mining
DHIVYADEVAKI
 
Data Preprocessing
Data PreprocessingData Preprocessing
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
Gajanand Sharma
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural network
Sopheaktra YONG
 
Performance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning AlgorithmsPerformance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning Algorithms
Kush Kulshrestha
 
Deep neural networks
Deep neural networksDeep neural networks
Deep neural networks
Si Haem
 
Long Short Term Memory
Long Short Term MemoryLong Short Term Memory
Long Short Term Memory
Yan Xu
 
Introduction to Recurrent Neural Network
Introduction to Recurrent Neural NetworkIntroduction to Recurrent Neural Network
Introduction to Recurrent Neural Network
Knoldus Inc.
 
Data preprocessing using Machine Learning
Data  preprocessing using Machine Learning Data  preprocessing using Machine Learning
Data preprocessing using Machine Learning
Gopal Sakarkar
 
Anomaly detection
Anomaly detectionAnomaly detection
Anomaly detection
QuantUniversity
 
Hierarchical Clustering
Hierarchical ClusteringHierarchical Clustering
Hierarchical Clustering
Carlos Castillo (ChaTo)
 
Autoencoders
AutoencodersAutoencoders
Autoencoders
CloudxLab
 
Feature Engineering & Selection
Feature Engineering & SelectionFeature Engineering & Selection
Feature Engineering & Selection
Eng Teong Cheah
 
Vanishing & Exploding Gradients
Vanishing & Exploding GradientsVanishing & Exploding Gradients
Vanishing & Exploding Gradients
Siddharth Vij
 
Back propagation
Back propagationBack propagation
Back propagation
Nagarajan
 
Artificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computationArtificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computation
Mohammed Bennamoun
 
Anomaly detection Workshop slides
Anomaly detection Workshop slidesAnomaly detection Workshop slides
Anomaly detection Workshop slides
QuantUniversity
 
Methods of Optimization in Machine Learning
Methods of Optimization in Machine LearningMethods of Optimization in Machine Learning
Methods of Optimization in Machine Learning
Knoldus Inc.
 

What's hot (20)

Linear regression
Linear regressionLinear regression
Linear regression
 
Recurrent neural networks rnn
Recurrent neural networks   rnnRecurrent neural networks   rnn
Recurrent neural networks rnn
 
Data preprocessing in Data Mining
Data preprocessing in Data MiningData preprocessing in Data Mining
Data preprocessing in Data Mining
 
Data Preprocessing
Data PreprocessingData Preprocessing
Data Preprocessing
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural network
 
Performance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning AlgorithmsPerformance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning Algorithms
 
Deep neural networks
Deep neural networksDeep neural networks
Deep neural networks
 
Long Short Term Memory
Long Short Term MemoryLong Short Term Memory
Long Short Term Memory
 
Introduction to Recurrent Neural Network
Introduction to Recurrent Neural NetworkIntroduction to Recurrent Neural Network
Introduction to Recurrent Neural Network
 
Data preprocessing using Machine Learning
Data  preprocessing using Machine Learning Data  preprocessing using Machine Learning
Data preprocessing using Machine Learning
 
Anomaly detection
Anomaly detectionAnomaly detection
Anomaly detection
 
Hierarchical Clustering
Hierarchical ClusteringHierarchical Clustering
Hierarchical Clustering
 
Autoencoders
AutoencodersAutoencoders
Autoencoders
 
Feature Engineering & Selection
Feature Engineering & SelectionFeature Engineering & Selection
Feature Engineering & Selection
 
Vanishing & Exploding Gradients
Vanishing & Exploding GradientsVanishing & Exploding Gradients
Vanishing & Exploding Gradients
 
Back propagation
Back propagationBack propagation
Back propagation
 
Artificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computationArtificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computation
 
Anomaly detection Workshop slides
Anomaly detection Workshop slidesAnomaly detection Workshop slides
Anomaly detection Workshop slides
 
Methods of Optimization in Machine Learning
Methods of Optimization in Machine LearningMethods of Optimization in Machine Learning
Methods of Optimization in Machine Learning
 

Similar to Scaling and Normalization

Data Transformation – Standardization & Normalization PPM.pptx
Data Transformation – Standardization & Normalization PPM.pptxData Transformation – Standardization & Normalization PPM.pptx
Data Transformation – Standardization & Normalization PPM.pptx
ssuser5cdaa93
 
5954987.ppt
5954987.ppt5954987.ppt
5954987.ppt
MukhtiarKhan5
 
dimension reduction.ppt
dimension reduction.pptdimension reduction.ppt
dimension reduction.ppt
Deadpool120050
 
MACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptxMACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptx
NAGARAJANS68
 
Dimensionality Reduction.pptx
Dimensionality Reduction.pptxDimensionality Reduction.pptx
Dimensionality Reduction.pptx
PriyadharshiniG41
 
Regression ppt
Regression pptRegression ppt
Regression ppt
SuyashSingh70
 
Lead Scoring Group Case Study Presentation.pdf
Lead Scoring Group Case Study Presentation.pdfLead Scoring Group Case Study Presentation.pdf
Lead Scoring Group Case Study Presentation.pdf
KrishP2
 
Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...
Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...
Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...
Maninda Edirisooriya
 
15303589.ppt
15303589.ppt15303589.ppt
15303589.ppt
ABINASHPADHY6
 
ML-Unit-4.pdf
ML-Unit-4.pdfML-Unit-4.pdf
ML-Unit-4.pdf
AnushaSharma81
 
Data preprocessing in Machine learning
Data preprocessing in Machine learning Data preprocessing in Machine learning
Data preprocessing in Machine learning
pyingkodi maran
 
Feature scaling
Feature scalingFeature scaling
Feature scaling
Gautam Kumar
 
support vector machine 1.pptx
support vector machine 1.pptxsupport vector machine 1.pptx
support vector machine 1.pptx
surbhidutta4
 
overview of_data_processing
overview of_data_processingoverview of_data_processing
overview of_data_processing
FEG
 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Boston Institute of Analytics
 
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning
Sanghamitra Deb
 
Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...
Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...
Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...
Maninda Edirisooriya
 
04 Classification in Data Mining
04 Classification in Data Mining04 Classification in Data Mining
04 Classification in Data Mining
Valerii Klymchuk
 
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
Megha Sharma
 

Similar to Scaling and Normalization (20)

Data Transformation – Standardization & Normalization PPM.pptx
Data Transformation – Standardization & Normalization PPM.pptxData Transformation – Standardization & Normalization PPM.pptx
Data Transformation – Standardization & Normalization PPM.pptx
 
5954987.ppt
5954987.ppt5954987.ppt
5954987.ppt
 
dimension reduction.ppt
dimension reduction.pptdimension reduction.ppt
dimension reduction.ppt
 
MACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptxMACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptx
 
Dimensionality Reduction.pptx
Dimensionality Reduction.pptxDimensionality Reduction.pptx
Dimensionality Reduction.pptx
 
Regression ppt
Regression pptRegression ppt
Regression ppt
 
Lead Scoring Group Case Study Presentation.pdf
Lead Scoring Group Case Study Presentation.pdfLead Scoring Group Case Study Presentation.pdf
Lead Scoring Group Case Study Presentation.pdf
 
Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...
Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...
Lecture 7 - Bias, Variance and Regularization, a lecture in subject module St...
 
15303589.ppt
15303589.ppt15303589.ppt
15303589.ppt
 
ML-Unit-4.pdf
ML-Unit-4.pdfML-Unit-4.pdf
ML-Unit-4.pdf
 
Data preprocessing in Machine learning
Data preprocessing in Machine learning Data preprocessing in Machine learning
Data preprocessing in Machine learning
 
Feature scaling
Feature scalingFeature scaling
Feature scaling
 
PCA.pptx
PCA.pptxPCA.pptx
PCA.pptx
 
support vector machine 1.pptx
support vector machine 1.pptxsupport vector machine 1.pptx
support vector machine 1.pptx
 
overview of_data_processing
overview of_data_processingoverview of_data_processing
overview of_data_processing
 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project Presentation
 
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning
 
Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...
Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...
Lecture 8 - Feature Engineering and Optimization, a lecture in subject module...
 
04 Classification in Data Mining
04 Classification in Data Mining04 Classification in Data Mining
04 Classification in Data Mining
 
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
 

More from Kush Kulshrestha

Clustering - Machine Learning Techniques
Clustering - Machine Learning TechniquesClustering - Machine Learning Techniques
Clustering - Machine Learning Techniques
Kush Kulshrestha
 
Machine Learning Algorithm - KNN
Machine Learning Algorithm - KNNMachine Learning Algorithm - KNN
Machine Learning Algorithm - KNN
Kush Kulshrestha
 
Machine Learning Algorithm - Decision Trees
Machine Learning Algorithm - Decision Trees Machine Learning Algorithm - Decision Trees
Machine Learning Algorithm - Decision Trees
Kush Kulshrestha
 
Machine Learning Algorithm - Naive Bayes for Classification
Machine Learning Algorithm - Naive Bayes for ClassificationMachine Learning Algorithm - Naive Bayes for Classification
Machine Learning Algorithm - Naive Bayes for Classification
Kush Kulshrestha
 
Machine Learning Algorithm - Logistic Regression
Machine Learning Algorithm - Logistic RegressionMachine Learning Algorithm - Logistic Regression
Machine Learning Algorithm - Logistic Regression
Kush Kulshrestha
 
Assumptions of Linear Regression - Machine Learning
Assumptions of Linear Regression - Machine LearningAssumptions of Linear Regression - Machine Learning
Assumptions of Linear Regression - Machine Learning
Kush Kulshrestha
 
Interpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine LearningInterpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine Learning
Kush Kulshrestha
 
Machine Learning Algorithm - Linear Regression
Machine Learning Algorithm - Linear RegressionMachine Learning Algorithm - Linear Regression
Machine Learning Algorithm - Linear Regression
Kush Kulshrestha
 
General Concepts of Machine Learning
General Concepts of Machine LearningGeneral Concepts of Machine Learning
General Concepts of Machine Learning
Kush Kulshrestha
 
Visualization-2
Visualization-2Visualization-2
Visualization-2
Kush Kulshrestha
 
Visualization-1
Visualization-1Visualization-1
Visualization-1
Kush Kulshrestha
 
Inferential Statistics
Inferential StatisticsInferential Statistics
Inferential Statistics
Kush Kulshrestha
 
Descriptive Statistics
Descriptive StatisticsDescriptive Statistics
Descriptive Statistics
Kush Kulshrestha
 
Wireless Charging of Electric Vehicles
Wireless Charging of Electric VehiclesWireless Charging of Electric Vehicles
Wireless Charging of Electric Vehicles
Kush Kulshrestha
 
Time management
Time managementTime management
Time management
Kush Kulshrestha
 
Handshakes and their types
Handshakes and their typesHandshakes and their types
Handshakes and their types
Kush Kulshrestha
 

More from Kush Kulshrestha (16)

Clustering - Machine Learning Techniques
Clustering - Machine Learning TechniquesClustering - Machine Learning Techniques
Clustering - Machine Learning Techniques
 
Machine Learning Algorithm - KNN
Machine Learning Algorithm - KNNMachine Learning Algorithm - KNN
Machine Learning Algorithm - KNN
 
Machine Learning Algorithm - Decision Trees
Machine Learning Algorithm - Decision Trees Machine Learning Algorithm - Decision Trees
Machine Learning Algorithm - Decision Trees
 
Machine Learning Algorithm - Naive Bayes for Classification
Machine Learning Algorithm - Naive Bayes for ClassificationMachine Learning Algorithm - Naive Bayes for Classification
Machine Learning Algorithm - Naive Bayes for Classification
 
Machine Learning Algorithm - Logistic Regression
Machine Learning Algorithm - Logistic RegressionMachine Learning Algorithm - Logistic Regression
Machine Learning Algorithm - Logistic Regression
 
Assumptions of Linear Regression - Machine Learning
Assumptions of Linear Regression - Machine LearningAssumptions of Linear Regression - Machine Learning
Assumptions of Linear Regression - Machine Learning
 
Interpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine LearningInterpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine Learning
 
Machine Learning Algorithm - Linear Regression
Machine Learning Algorithm - Linear RegressionMachine Learning Algorithm - Linear Regression
Machine Learning Algorithm - Linear Regression
 
General Concepts of Machine Learning
General Concepts of Machine LearningGeneral Concepts of Machine Learning
General Concepts of Machine Learning
 
Visualization-2
Visualization-2Visualization-2
Visualization-2
 
Visualization-1
Visualization-1Visualization-1
Visualization-1
 
Inferential Statistics
Inferential StatisticsInferential Statistics
Inferential Statistics
 
Descriptive Statistics
Descriptive StatisticsDescriptive Statistics
Descriptive Statistics
 
Wireless Charging of Electric Vehicles
Wireless Charging of Electric VehiclesWireless Charging of Electric Vehicles
Wireless Charging of Electric Vehicles
 
Time management
Time managementTime management
Time management
 
Handshakes and their types
Handshakes and their typesHandshakes and their types
Handshakes and their types
 

Recently uploaded

一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
Opendatabay
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
pchutichetpong
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
benishzehra469
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
ewymefz
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 

Recently uploaded (20)

一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 

Scaling and Normalization

  • 1. Lesson 5 Scaling and Normalization Kush Kulshrestha
  • 2. Topics 1. Scaling of Data 2. Data Normalization 3. Difference between Scaling and Normalization 4. Min-max scalar and Box-Cox Transformation
  • 3. Scaling of data • Variable scaling requires taking values that span a specific range and representing them in another range. • The standard method is to scale variables to [0,1]. • This may introduce various distortions or biases into the data but the distribution or shape remains same. • Depending on the modeling tool, scaling variable ranges can be beneficial or sometimes even required. One way of doing this is: Linear Scaling Transform • First task in this scaling is to determine the minimum and maximum values of variables. • Then applying the transform: (x - min{x1, xN}) / (max{x1, xN} - min{x1, xN}) • This introduces no distortion to the variable distribution. • Has a one-to-one relationship between the original and scaled values.
  • 4. Scaling of data Out of Range values • In data preparation, the data used is only a sample of the population. • Therefore, it is not certain that the actual minimum and maximum values of the variable have been discovered when scaling the ranges. • If some values that turn up later in the mining process are outside of the limits discovered in the sample, they are called out-of-range values.
  • 5. Scaling of data Dealing with Out of Range values • After range scaling, all variables should be in the range of [0,1]. • Out-of-range values, however, have values like -0.2 or 1.1 which can cause unwanted behavior. Solution 1: Ignore that the range has been exceeded. • Most modeling tools have (at least) some capacity to handle numbers outside the scaling range. • Important question to ask: Does this affect the quality of the model? Solution 2: Exclude the out of range instances. • One problem is that reducing the number of instances reduces the confidence that the sample represents the population. • Another problem: Introduction of bias. Out-of-range values may occur with a certain pattern and ignoring these instances removes samples according to a pattern introducing distortion to the sample
  • 6. Scaling of data Dealing with Out of Range values Solution 3: Clip the out of range values • If the value is greater than 1, assign 1 to it. If less than 0, assign 0. • This approach assumes that out-of-range values are somehow equivalent with range limit values. • Therefore, the information content on the limits is distorted by projecting multiple values into a single value. • This also introduces some bias. Solution 4: Making room for out of range values • The linear scaling transform provides an undistorted normalization but suffers from out-of-range values. • Therefore, we should modify it to somehow include also values that are out of range. • Most of the population is inside the range so for these values the normalization should be linear. • The solution is to reserve some part of the range for the out-of-range values. • Reserved amount of space depends on the confidence level of the sample: e.g. - 98% confidence linear part is [0.01, 0.99]
  • 7. Scaling of data Dealing with Out of Range values Squashing the out of range values • Now the problem reduces to fitting the out-of-range values into the space left for them. • The greater the difference between a value and the range limit, the less likely any such value is found. • Therefore, the transformation should be such that as the distance to the range grows, the smaller the increase towards one or decrease towards zero. • One possibility is to use functions of the form y =1/x and attach them to the ends of the linear part. Its difficult to carry out the scaling in pieces depending on the nature of the data point. We can do all of the above steps using one function called Softmax scaling.
  • 8. Scaling of data Dealing with Out of Range values Softmax Scaling – • The extent of the linear part can be controlled by one parameter. • The space assigned for out-of-range values can be controlled by the level of uncertainty in the sample. • Non identical values have always different normalized values. Softmax scaling is based on the logistic function: y = 1 / (1 + e-x) Where y is the scaled value and x is the input value. • The logistic function transforms the original range of [-,] to [0,1] and also has a linear part on the transform.
  • 9. Scaling of data Min-Max Scaler In scikit-learn
  • 10. Data Normalization • Applying a function to each data point z in the data: yi = f(zi) • Unlike scaling, not only the data is distorted, but the shape or distribution of the data changes as well. • The point of normalization is to change your observations so that they can be described as a normal distribution. • In general, you'll only want to normalize your data if you're going to be using a machine learning or statistics technique that assumes your data is normally distributed. • Or before using any technique containing “Gaussian” in its name.
  • 11. Data Normalization Data Standardization • Also called z-scores. • The terms normalization and standardization are sometimes used interchangeably. • Standardization transforms data to have a mean of zero and a standard deviation of 1. • Done by subtracting the mean and dividing by the standard deviation for each data point.
  • 12. Data Normalization Log Transformation • The log transformation can be used to make highly skewed distributions less skewed. • This can be valuable both for making patterns in the data more interpretable and for helping to meet the assumptions of inferential statistics. • Figure shows an example of how a log transformation can make patterns more visible. Both graphs plot the brain weight of animals as a function of their body weight. The raw weights are shown in the left panel; the log-transformed weights are plotted in the right panel.
  • 13. Data Normalization Box-Cox Transformation The Box-Cox transformation of the variable x is also indexed by λ, and is defined as: • Box-Cox transformations cannot handle negative values. • One way to deal with this is by adding the minimum data point value to add the data points. • We want to use the same lambda generated from the training set of box cox transformation in the test set. • Another way to write this equation: as ƛ turns to be 0
  • 14. Data Normalization Box-Cox Transformation Notice with this definition of that x = 1 always maps to the point = 0 for all values of λ. To see how the transformation works, look at the examples in Figure.
  • 15. Data Normalization Box-Cox Transformation In the top row, the choice λ = 1 simply shifts x to the value x−1, which is a straight line. In the bottom row (on a semi-logarithmic scale), the choice λ = 0 corresponds to a logarithmic transformation, which is now a straight line. We superimpose a larger collection of transformations on a semi-logarithmic scale in Figure 2.
  • 17. Data Normalization Why do we need normalization? 1. Some algorithms need normally distributed data as input, otherwise the results are not reliable. 2. Easy comparison of values. 3. Interpretation of results makes more sense. 4. Objective function works faster in some cases if the data is normalized, i.e., speed of the algorithm increases. 5. Can create complex features that may improve the model (or make it non-linear)