Save MinMaxScaler model in sklearn

前端 未结 5 1523
青春惊慌失措
青春惊慌失措 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:47

    Just a note that sklearn.externals.joblib has been deprecated and is superseded by plain old joblib, which can be installed with pip install joblib:

    import joblib
    joblib.dump(my_scaler, 'scaler.gz')
    my_scaler = joblib.load('scaler.gz')
    

    Note that file extensions can be anything, but if it is one of ['.z', '.gz', '.bz2', '.xz', '.lzma'] then the corresponding compression protocol will be used. Docs for joblib.dump() and joblib.load() methods.

提交回复
热议问题