[sklearn][standardscaler] 我可以反转模型输出的standardscaler吗?

问题描述:

我有一些结构如下的数据,试图从特征中预测 t.

I have some data structured as below, trying to predict t from the features.

train_df

t: time to predict
f1: feature1
f2: feature2 
f3:......

t 是否可以用 StandardScaler 进行缩放,所以我改为预测 t',然后对 StandardScaler 求逆以获取实时?

Can t be scaled with StandardScaler, so I instead predict t' and then inverse the StandardScaler to get back the real time?

例如:

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaler.fit(train_df['t'])
train_df['t']= scaler.transform(train_df['t'])

运行回归模型,

检查分数,

!!用实时值检查预测的 t'(逆 StandardScaler)

!! check predicted t' with real time value(inverse StandardScaler) <- possible?

是的,它被方便地称为 inverse_transform.

Yeah, and it's conveniently called inverse_transform.

文档提供了使用示例.