Normalize a sequence of batches while maintaining running per-feature extrema. Initialize each running minimum to +∞ and each running maximum to −∞. For every incoming batch, update both arrays before normalizing that batch:
xij′=max(Mj−mj,ε)xij−mjHere, mj and Mj are the updated running minimum and maximum for feature j, and ε is eps. Return normalized_batches as a list of NumPy arrays and the final min and max arrays in a dictionary.
Input: D = 2, batches = [[[1, 3], [2, 1]]]
Output: {"normalized_batches": [[[0.0, 1.0], [1.0, 0.0]]], "min": [1.0, 1.0], "max": [2.0, 3.0]}
Explanation: The first batch establishes both feature ranges before it is normalized.
Input: D = 1, batches = [[[5], [3]]]
Output: {"normalized_batches": [[[1.0], [0.0]]], "min": [3.0], "max": [5.0]}
Update state with np.minimum, np.maximum, np.min, and np.max.
Use np.maximum(running_max - running_min, eps) as the denominator.
Sign in to take notes on this problem
Accepts: number
Accepts: array
Normalize a sequence of batches while maintaining running per-feature extrema. Initialize each running minimum to +∞ and each running maximum to −∞. For every incoming batch, update both arrays before normalizing that batch:
xij′=max(Mj−mj,ε)xij−mjHere, mj and Mj are the updated running minimum and maximum for feature j, and ε is eps. Return normalized_batches as a list of NumPy arrays and the final min and max arrays in a dictionary.
Input: D = 2, batches = [[[1, 3], [2, 1]]]
Output: {"normalized_batches": [[[0.0, 1.0], [1.0, 0.0]]], "min": [1.0, 1.0], "max": [2.0, 3.0]}
Explanation: The first batch establishes both feature ranges before it is normalized.
Input: D = 1, batches = [[[5], [3]]]
Output: {"normalized_batches": [[[1.0], [0.0]]], "min": [3.0], "max": [5.0]}
Update state with np.minimum, np.maximum, np.min, and np.max.
Use np.maximum(running_max - running_min, eps) as the denominator.
Sign in to take notes on this problem
Accepts: number
Accepts: array