本文介绍了[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
.
文档提供了使用示例.
这篇关于[sklearn][standardscaler] 我可以反转模型输出的standardscaler吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!