Python is a simple way to save the model: save the training model with joblib

 

In machine learning, after we train the model, we need to save the model locally. Use joblib to implement a simple model saving method:

import joblib

#保存模型
def save_model(model, filepath):
    # 后缀一般用pkl
	joblib.dump(model, filename=filepath)

def load_model(filepath):
	model = joblib.load(filepath)
	return model

 

Guess you like

Origin blog.csdn.net/guyu1003/article/details/109017083