Save MinMaxScaler model in sklearn

前端 未结 5 1524
青春惊慌失措
青春惊慌失措 2020-12-23 13:58

I\'m using the MinMaxScaler model in sklearn to normalize the features of a model.

training_set = np.random.rand(4,4)*10
training_set

       [[         


        
5条回答
  •  不知归路
    2020-12-23 14:38

    Even better than pickle (which creates much larger files than this method), you can use sklearn's built-in tool:

    from sklearn.externals import joblib
    scaler_filename = "scaler.save"
    joblib.dump(scaler, scaler_filename) 
    
    # And now to load...
    
    scaler = joblib.load(scaler_filename) 
    

    Note: sklearn.externals.joblib is deprecated. Install and use the pure joblib instead

提交回复
热议问题