MLeasyData processing~10m
Min-Max Normalization to 0-1
Problem
Implement min-max normalization that scales input values to the range [0, 1] using the formula (x - min) / (max - min). Handle the edge case where all values are identical.
Examples
Example 1
Input:
[1, 2, 3, 4, 5]Output:
[0.0, 0.25, 0.5, 0.75, 1.0]Values scaled linearly from min=1 to max=5 into range [0,1].
Constraints
- ›NumPy only (import numpy as np)
- ›Function must be named solution
Reference solution
Reference solution available after you attempt the question.
Ready to solve it?
Start a session on Mockbit #91. You'll get graded with specific critique when you submit.
Related ML questions
← Back homemockbit.io/q/91