Min-Max Scaling

IT 위키
Fortify (토론 | 기여)님의 2024년 11월 30일 (토) 14:19 판 (Created page with "'''Min-Max Scaling''' is a data normalization technique used to scale features to a fixed range, typically [0, 1]. It ensures that all features contribute equally to the analysis or model by transforming the original values proportionally to fit within the specified range. Min-Max Scaling is widely used in data preprocessing for machine learning and statistical analysis. ==Overview== Min-Max Scaling transforms the data linearly by rescaling each value based on the featur...")
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

Min-Max Scaling is a data normalization technique used to scale features to a fixed range, typically [0, 1]. It ensures that all features contribute equally to the analysis or model by transforming the original values proportionally to fit within the specified range. Min-Max Scaling is widely used in data preprocessing for machine learning and statistical analysis.

1 Overview

Min-Max Scaling transforms the data linearly by rescaling each value based on the feature's minimum and maximum values. This technique is particularly useful when the data needs to be bounded within a specific range, such as [0, 1] or [-1, 1].

Key characteristics:

  • Ensures all values are within the specified range.
  • Preserves the relationships between original values.
  • Sensitive to outliers, as extreme values can distort the scaling.

2 Formula

The formula for Min-Max Scaling is:

X' = (X - X_min) / (X_max - X_min)

Where:

  • X: The original value.
  • X_min: The minimum value of the feature.
  • X_max: The maximum value of the feature.
  • X': The scaled value within the range [0, 1].

3 Example

Consider a dataset with the following values:

Original Value Min-Max Scaled Value (Range: 0 to 1)
10 0.0
15 0.5
20 1.0

3.1 Steps

  1. Find the minimum (X_min) and maximum (X_max) values:
    • X_min = 10
    • X_max = 20
  2. Apply the formula:
    • For X = 10: X' = (10 - 10) / (20 - 10) = 0.0
    • For X = 15: X' = (15 - 10) / (20 - 10) = 0.5
    • For X = 20: X' = (20 - 10) / (20 - 10) = 1.0

4 Applications

Min-Max Scaling is commonly used in:

  • Machine Learning:
    • Preprocessing features for models sensitive to feature scale, such as neural networks and gradient descent-based algorithms.
  • Image Processing:
    • Normalizing pixel intensities to the range [0, 1].
  • Finance:
    • Scaling stock prices or other financial metrics for analysis and comparison.
  • Data Visualization:
    • Ensuring uniform scale across variables for clear and consistent visualization.

5 Advantages

  • Ensures all features contribute equally to the model.
  • Simple and computationally efficient.
  • Suitable for features with known bounds.

6 Limitations

  • Sensitive to outliers, as extreme values can skew the scaling.
  • Requires knowledge of the minimum and maximum values for consistent scaling.
  • Does not standardize the data (e.g., mean ≠ 0, standard deviation ≠ 1).

7 Python Code Example

import numpy as np
from sklearn.preprocessing import MinMaxScaler

# Example data
data = np.array([[10], [15], [20]])

# Min-Max Scaling
scaler = MinMaxScaler(feature_range=(0, 1))
scaled_data = scaler.fit_transform(data)

print("Original Data:", data.flatten())
print("Scaled Data:", scaled_data.flatten())

8 See Also