Why does standardized output contain negative values while min-max output does not?
Conditions
- Standardization uses .
- Min-max uses .
Reasoning, step by step
- For standardization, subtracting from yields negative results if .
- For min-max, subtracting ensures the numerator is non-negative, and dividing by the positive range keeps the result in [0, 1].
- Observe that Out[11] (standardization) has negatives like -0.56, while Out[8] (min-max) has values like 0.19 and 1.0.
Example
The video shows Out[11] with negative values like -0.5622498 for standardization, and Out[8] with values between 0 and 1 for min-max scaling.
Common misconceptions
- Believing that standardization should also produce values between 0 and 1.
- Thinking that negative standardized values indicate an error in calculation.
Watch the explanation
Connected concepts
Explore next
Related questions
Decision-tree models do not require feature scaling because they split data based on feature conditions (thresholds) rather than absolute magnitudes. Monotonic rescaling of feature values does not change the branching structure or the order of splits.
Conditions: Model is a decision tree or an ensemble of trees (random forest, XGBoost, etc.).; Splitting logic is based on comparing feature values to thresholds.
Feature scaling is needed because raw features often differ in units and magnitudes, making them incomparable. Scaling brings them onto a common scale, which is necessary for many machine learning algorithms to function properly.
Conditions: Dataset contains multiple features with different units or ranges.; The model is sensitive to feature magnitudes (e.g., distance-based or gradient-based).
Import `MinMaxScaler` from `sklearn.preprocessing`, instantiate it, and call `fit_transform` on the selected DataFrame columns. This fits the scaler to the data (learning min/max) and transforms the values to the [0, 1] range.
Conditions: Input data is numerical.; Scikit-learn library is installed.
Standardization transforms a feature value into , targeting a mean of 0 and a standard deviation of 1 for the transformed feature.
Conditions: Applied per numerical feature.; Uses the feature mean and standard deviation .; Assumes .
Import `StandardScaler` from `sklearn.preprocessing`, instantiate it, and call `fit_transform` on the selected DataFrame columns. This transforms the data to have mean 0 and standard deviation 1.
Conditions: Input data is numerical.; Scikit-learn library is installed.
Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.