📜  StandardScaler sklearn 获取参数规范化 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:37.701000             🧑  作者: Mango

代码示例1
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaler.fit(data)
scaled_data = scaler.transform(data)

means = scaler.mean_ 
vars = scaler.var_   

# for later usage of means and vars
def scale_data(array,means=means,stds=vars **0.5):
    return (array-means)/stds

scale_new_data = scale_data(new_data)