[sklearn][standardscaler] can I inverse the standardscaler for the model output?

后端 未结 2 359
面向向阳花
面向向阳花 2021-01-07 23:05

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:......
<         


        
2条回答
  •  借酒劲吻你
    2021-01-07 23:41

    Here is sample code. You can replace here data with train_df['colunm_name']. Hope it helps.

    from sklearn.preprocessing import StandardScaler
    data = [[1,1], [2,3], [3,2], [1,1]]
    scaler = StandardScaler()
    scaler.fit(data)
    scaled = scaler.transform(data)
    print(scaled)
    
    # for inverse transformation
    inversed = scaler.inverse_transform(scaled)
    print(inversed)
    

提交回复
热议问题