Boston
Boston

Reputation: 13

Using MinMaxScaler on arrays and getting scaling parameters for later use: missing values

I have this issue when trying to use sklearn.preprocessing.MinMaxScaler on a large array and obtaining the scaling parameters to do "redo" the normalization after handling the array for a while.

The issue I have is that after doing my MinMaxScaler.fit_transform(data), where data is a numpy array with shape (8,412719), the scaling parameters obtained with MinMaxScaler.scale_ is just a list with length 412719.

How do I obtain an array with scaling parameters instead? I'm missing 7 columns worth of scaling parameters if I've not misunderstood something.

Upvotes: 1

Views: 903

Answers (1)

I build my X dataframe and y target then scaler the X dataframe

df3.dropna(inplace=True)
X_Columns=[column for column in df3.columns if not column in["Target","DateTime","Date","CO2Intensity","ActualWindProduction","ORKWindspeed","ForecastWindProduction"]]
#print(X_Columns)
X=df3[X_Columns]
#print(X)
y=df3["Target"]

scaler=MinMaxScaler()

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20, random_state = 0)

X_train_scaled = scaler.fit_transform(X_train)

classifier = GaussianNB()
classifier.fit(X_train_scaled, y_train)

Upvotes: 0

Related Questions