ایزی‌ساز
هوش مصنوعی

Methods of Data Normalization

تاریخ انتشار: ۱۵ مهر ۱۴۰۳4 دقیقه مطالعه

Methods of Data Normalization

Methods of Data Normalization

Data normalization is a crucial step in data preprocessing to standardize and scale data values across various ranges. This helps improve the performance and accuracy of machine learning models. Below are several methods of normalization, each suited for different scenarios:

1. Min-Max Normalization

Min-Max Normalization scales data values to a specific range, typically between 0 and 1. This method adjusts the data so that the minimum value becomes 0 and the maximum value becomes 1, with other values linearly adjusted in between.

Formula:

Where:

• X is the original value.

• X' is the normalized value.

• X_{min} and X_{max} are the minimum and maximum values in the dataset, respectively.

Use Cases: Algorithms like K-Nearest Neighbors (KNN) and neural networks benefit from Min-Max Normalization as it brings features to a common scale without distorting differences.

Advantages: Preserves relationships between data points, simple and computationally efficient.

Limitations: Sensitive to outliers, and new data outside the original range may produce values outside the normalized range.

Example Code:

2. Z-Score Normalization (Standardization)

Z-Score Normalization standardizes data by centering it around a mean of 0 and scaling it with a standard deviation of 1.

Formula:

Where:

• X is the original value.

• \mu is the mean.

• \sigma is the standard deviation.

Use Cases: Algorithms like Logistic Regression, SVM, and K-Means benefit from Z-Score normalization because they assume normally distributed input data.

Advantages: Less sensitive to outliers than Min-Max Normalization, faster convergence in training.

Limitations: Outliers can still affect results, and it doesn’t bound the data within a specific range.

Example Code:

3. Decimal Scaling

Decimal Scaling scales data by moving the decimal point based on the maximum absolute value.

Formula:

Where j is the smallest integer that ensures all normalized values fall within [-1, 1].

Use Cases: Useful when the data values vary across several orders of magnitude.

Limitations: May not be effective with small datasets or those containing outliers.

4. Max Abs Normalization

Max Abs Normalization scales data by dividing each value by the maximum absolute value, retaining both positive and negative signs.

Formula:

Use Cases: Ideal for datasets with both positive and negative values, especially for models like SVM and PCA.

Advantages: Retains the sign of the data.

Limitations: Sensitive to extreme outliers.

Example Code:

5. Robust Scaler

Robust Scaler uses statistics like the median and interquartile range (IQR) to scale the data, making it robust to outliers.

Formula:

Use Cases: Ideal for datasets with extreme values.

Advantages: Resistant to outliers, focuses on the middle 50% of data.

Limitations: May not be effective for small datasets.

Example Code:

6. Log Transformation

Log Transformation applies the logarithmic function to reduce skewness in data with a wide range of values.

Formula:

Use Cases: Helpful for compressing large values and reducing skewness in data distributions.

Limitations: Only applicable to positive values.

7. Power Transformation

Power Transformation includes the Box-Cox (for strictly positive data) and Yeo-Johnson (for both positive and negative data) transformations, used to stabilize variance and make data more Gaussian-like.

Formula (Box-Cox):

Use Cases: Effective for highly skewed data.

Advantages: Improves normality of data.

Limitations: Sensitive to parameter tuning, non-reversible.

Example Code:

8. L2 Normalization

L2 Normalization scales data points so that the Euclidean norm of each point is equal to 1.

Formula:

Where is the L2 norm calculated as:

Use Cases: Often used in models relying on distance calculations, such as KNN and SVM.

Advantages: Ensures equal contribution of features to the model.

Limitations: Sensitive to outliers, does not encourage sparsity.

Example Code:

Conclusion

Choosing the right normalization method depends on the characteristics of the data and the algorithm used. Proper normalization can significantly improve model performance by ensuring that features contribute equally to the learning process.

References

• Scikit-learn Documentation: Source

• Books and Tutorials: "Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow" by Aurélien Géron

• "Pattern Recognition and Machine Learning" by Christopher M. Bishop

سایت یا ایده‌تان را رایگان بررسی می‌کنیم

در یک جلسه آنلاین ۱۵ دقیقه‌ای، سه پیشنهاد عملی برای بهبود کسب‌وکار دیجیتال شما می‌دهیم — حتی اگر با ما کار نکنید.

معمولاً در کمتر از ۲ ساعت کاری پاسخ می‌دهیم.