MinMaxScaler

As I am not using MixMaxScaler, I am not able to do the inverse transform for real prices. Can you help me with an example, please?

Hello Everton,



Are you getting the following error? 



"ValueError: operands could not be broadcast together with shapes" 



If this is the case, then you need to make sure that you're using the same object to inverse_transform that you used to fit the MixMaxScaler. Also, make sure the dimensions used to fit are the same that are being inversed. 



 

The point is this, I don't use MixMaxScaler, because you say in the course that it does the standardization of each column. The suggestion is to use the code below:

Specify the test data size

test_size=100

To avoid any look forward bias we will be taking only the train data to scale the data

max_=data.iloc[:-test_size][['Open','High','Low','Close']].max().max() #Using .max() once gives the maximum values of each column

min_=data.iloc[:-test_size][['Open','High','Low','Close']].min().min()

max_,min_

X1=(data[['Open','High','Low','Close']]-min_)/(max_-min_)

X1=np.array(X1)

 

The problem is that using the code above, I cannot do the reverse process, which in the case of MinMaxScaler, would be to use the inverse_transform

Can you help me?

Hello Everton,



It is perfectly fine to use the minmax scalar if you want. 



You can also reverse both for the test and the training data by using something like:



reverse_X1=[(data[['Open','High','Low','Close']])*(max_-min_)] + min_



But use the same values of _max and _min for both the test and the training data. This _min and _max belongs to the training data.