I am using MinMaxScaler from sklearn to scale the input to values between 0 and 1 and then process the data to obtain another vector. I use inverse_transform on the obtained vector to get back values in the original range. The shapes of the input to the fit_transform and the input to the inverse_transform are different. As an MWE I have provided the following code.
import numpy as np
from sklearn.preprocessing import MinMaxScaler
sc = MinMaxScaler(feature_range=(0, 1))
a = np.random.randint(0, 10, (10, 5))
b = sc.fit_transform(a) # b values are in [0, 1] range
c = np.random.rand(10, 30) # as an example, I have generated values between 0 and 1
d = sc.inverse_transform(c)
I run into the error
ValueError: operands could not be broadcast together with shapes (10,30) (5,) (10,30)
I understand it is because of the shape mismatch. But the shapes of inputs in my actual code are fixed and cannot be changed (and are also different from each other). How can I get this to work? Any help is appreciated.