1. 程式人生 > >Python資料標準化儲存與獲取

Python資料標準化儲存與獲取

from sklearn.preprocessing import MinMaxScaler
from sklearn.externals import joblib
scaler = MinMaxScaler(feature_range=(0, 1))
scaler_model = scaler.fit(data)
#模型儲存
joblib.dump(scaler_model, "scaler.model")
#模型獲取
scaler = joblib.load('scaler.model')
data_scaled = scaler.transform(data)