Feature scaling

Short description: Method used to normalize the range of independent variables

Machine learning and
data mining

Problems

* Classification
* Clustering
* Regression
* Anomaly detection
* AutoML
* Association rules
* Reinforcement learning
* Structured prediction
* Feature engineering
* Feature learning
* Online learning
* Semi-supervised learning
* Unsupervised learning
* Learning to rank
* Grammar induction

Supervised learning
(classification • regression)

* Decision trees
* Ensembles
* Bagging
* Boosting
* Random forest
* k-NN
* Linear regression
* Naive Bayes
* Artificial neural networks
* Logistic regression
* Perceptron
* Relevance vector machine (RVM)
* Support vector machine (SVM)

Clustering

* BIRCH
* CURE
* Hierarchical
* k-means
* Expectation–maximization (EM)

DBSCAN
* OPTICS
* Mean-shift

Dimensionality reduction

* Factor analysis
* CCA
* ICA
* LDA
* NMF
* PCA
* t-SNE

Structured prediction

* Graphical models
* Bayes net
* Conditional random field
* Hidden Markov

Anomaly detection

* k-NN
* Local outlier factor

Artificial neural networks

* Autoencoder
* Deep learning
* DeepDream
* Multilayer perceptron
* RNN
* LSTM
* GRU
* Restricted Boltzmann machine
* GAN
* SOM
* Convolutional neural network
* U-Net

Reinforcement learning

* Q-learning
* SARSA
* Temporal difference (TD)

Theory

* Bias–variance dilemma
* Computational learning theory
* Empirical risk minimization
* Occam learning
* PAC learning
* Statistical learning
* VC theory

Machine-learning venues

* NeurIPS
* ICML
* ML
* JMLR
* ArXiv:cs.LG

Glossary of artificial intelligence

* Glossary of artificial intelligence

Related articles

* List of datasets for machine-learning research
* Outline of machine learning

* v
* t
* e

Feature scaling is a method used to normalize the range of independent variables or features of data. In data processing, it is also known as data normalization and is generally performed during the data preprocessing step.

## Contents

* 1 Motivation
* 2 Methods
* 2.1 Rescaling (min-max normalization)
* 2.2 Mean normalization
* 2.3 Standardization (Z-score Normalization)
* 2.4 Robust Scaling
* 2.5 Unit vector normalization
* 3 See also
* 4 References
* 5 Further reading
* 6 External links

## Motivation

Since the range of values of raw data varies widely, in some machine learning algorithms, objective functions will not work properly without normalization. For example, many classifiers calculate the distance between two points by the Euclidean distance. If one of the features has a broad range of values, the distance will be governed by this particular feature. Therefore, the range of all features should be normalized so that each feature contributes approximately proportionately to the final distance.

Another reason why feature scaling is applied is that gradient descent converges much faster with feature scaling than without it.[1]

It's also important to apply feature scaling if regularization is used as part of the loss function (so that coefficients are penalized appropriately).

Empirically, feature scaling can improve the convergence speed of stochastic gradient descent. In support vector machines,[2] it can reduce the time to find support vectors. Feature scaling is also often used in applications involving distances and similarities between data points, such as clustering and similarity search. As an example, the K-means clustering algorithm is sensitive to feature scales.

## Methods

### Rescaling (min-max normalization)

Also known as min-max scaling or min-max normalization, rescaling is the simplest method and consists in rescaling the range of features to scale the range in [0, 1] or [−1, 1]. Selecting the target range depends on the nature of the data. The general formula for a min-max of [0, 1] is given as:[3]

x′=x−min(x)max(x)−min(x)

where x is an original value, x′ is the normalized value. For example, suppose that we have the students' weight data, and the students' weights span [160 pounds, 200 pounds]. To rescale this data, we first subtract 160 from each student's weight and divide the result by 40 (the difference between the maximum and minimum weights).

To rescale a range between an arbitrary set of values [a, b], the formula becomes:

x′=a+(x−min(x))(b−a)max(x)−min(x)

where a,b are the min-max values.

### Mean normalization

x′=x−x¯max(x)−min(x)

where x is an original value, x′ is the normalized value, x¯=average(x) is the mean of that feature vector. There is another form of the means normalization which divides by the standard deviation which is also called standardization.

### Standardization (Z-score Normalization)

See also: Standard score

The effect of z-score normalization on k-means clustering. 4 gaussian clusters of points are generated, then squashed along the y-axis, and a k=4 clustering was computed. Without normalization, the clusters were arranged along the x-axis, since it is the axis with most of variation. After normalization, the clusters are recovered as expected.

In machine learning, we can handle various types of data, e.g. audio signals and pixel values for image data, and this data can include multiple dimensions. Feature standardization makes the values of each feature in the data have zero-mean (when subtracting the mean in the numerator) and unit-variance. This method is widely used for normalization in many machine learning algorithms (e.g., support vector machines, logistic regression, and artificial neural networks).[4][5] The general method of calculation is to determine the distribution mean and standard deviation for each feature. Next we subtract the mean from each feature. Then we divide the values (mean is already subtracted) of each feature by its standard deviation.

x′=x−x¯σ

Where x is the original feature vector, x¯=average(x) is the mean of that feature vector, and σ is its standard deviation.

### Robust Scaling

Robust scaling, also known as standardization using median and interquartile range (IQR), is designed to be robust to outliers. It scales features using the median and IQR as reference points instead of the mean and standard deviation:x′=x−Q2(x)Q3(x)−Q1(x)where Q1(x),Q2(x),Q3(x) are the three quartiles (25th, 50th, 75th percentile) of the feature.

### Unit vector normalization

Unit vector normalization regards each individual data point as a vector, and divide each by its vector norm, to obtain x′=x/‖x‖. Any vector norm can be used, but the most common ones are the L1 norm and the L2 norm.

For example, if x=(v1,v2,v3), then its Lp-normalized version is:(v1(|v1|p+|v2|p+|v3|p)1/p,v2(|v1|p+|v2|p+|v3|p)1/p,v3(|v1|p+|v2|p+|v3|p)1/p)

## See also

* Normalization (machine learning)
* Normalization (statistics)
* Standard score
* fMLLR, Feature space Maximum Likelihood Linear Regression

## References

1. ↑ Ioffe, Sergey; Christian Szegedy (2015). "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift". arXiv:1502.03167 [cs.LG].
2. ↑ Juszczak, P.; D. M. J. Tax; R. P. W. Dui (2002). "Feature scaling in support vector data descriptions". Proc. 8th Annu. Conf. Adv. School Comput. Imaging: 25–30.
3. ↑ "Min Max normalization". https://ml-concepts.com/2021/10/08/min-max-normalization/.
4. ↑ Grus, Joel (2015). Data Science from Scratch. Sebastopol, CA: O'Reilly. pp. 99, 100. ISBN 978-1-491-90142-7.
5. ↑ Hastie, Trevor; Tibshirani, Robert; Friedman, Jerome H. (2009) (in en). The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer. ISBN 978-0-387-84884-6. https://books.google.com/books?id=eBSgoAEACAAJ.

## Further reading

* Han, Jiawei; Kamber, Micheline; Pei, Jian (2011). "Data Transformation and Data Discretization". Data Mining: Concepts and Techniques. Elsevier. pp. 111–118. ISBN 9780123814807. https://books.google.com/books?id=pQws07tdpjoC&pg=PA111.

## External links

* Lecture by Andrew Ng on feature scaling

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Feature scaling. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Feature_scaling&oldid=4153710"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template