I am using StandardScaler()
to standardize the inputs.
How can I convert prediction back to original data? I am using the following code, but it throws me an error.
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)
#custom inputs for prediction after training
sample = pd.DataFrame({'salary': [1211], 'age': [30]})
sample = sc.transform(sample)
sample_predict = sc.inverse_transform(sample_predict)
print (sample_predict)
- shape of
X_test
:(3000, 2)
- shape of
sample_predict
:(1, 2)
Error:
X *= self.scale_
ValueError: non-broadcastable output operand with shape (1,1) doesn't match the broadcast shape (1,2)