How to Save Trained Model using Joblib in Machine Learning
Free Machine Learning courses with 130+ real-time projects Start Now!!
Program 1
import pandas as pd # Version 2.2.2 import numpy as np # Version 1.24.3 import matplotlib.pyplot as plt # Version 3.7.1 from sklearn import linear_model # 1.5.1 import joblib df=pd.read_csv("D://scikit_data/home/homeprices.csv") print(df) model=linear_model.LinearRegression() model.fit(df.drop('price',axis='columns'),df.price) print(model) print("Model Predication: ",model.predict([[3400]])) print("Model Coficient: ",model.coef_) print("Model Intercept: ",model.intercept_) joblib.dump(model,'model_joblib') print("--------------File Dump-------------") mymodel=joblib.load('model_joblib') print(mymodel) print("My Model Predication: ",mymodel.predict([[3400]])) print("My Model Coficient: ",mymodel.coef_) print("My Model Intercept: ",mymodel.intercept_)
You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google