Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

model pickle file create

import pickle

# save the model to disk
filename = 'finalized_model.sav'
pickle.dump(model, open(filename, 'wb'))
 
# some time later...
 
# load the model from disk
loaded_model = pickle.load(open(filename, 'rb'))
result = loaded_model.score(X_test, Y_test)
print(result)
Comment

save model pickle

with open('model_pkl', 'wb') as files:
    pickle.dump(model, files)
with open('model_pkl' , 'rb') as f:
    lr = pickle.load(f)   
Comment

PREVIOUS NEXT
Code Example
Python :: pandas df where row has na 
Python :: get stats from array python 
Python :: python 3 text file leng 
Python :: how to add legend to python plot 
Python :: how to check sklearn version in cmd 
Python :: python random text generator 
Python :: python print exception message and stack trace 
Python :: change tkinter window name 
Python :: streamlit pip 
Python :: split data into training, testing and validation set python 
Python :: incognito in selenium 
Python :: how to import pygame onto python 
Python :: access the value in settings django 
Python :: Getting Random rows in dataframe 
Python :: check python version mac 
Python :: rgb to grayscale python opencv 
Python :: python flip a coin 
Python :: object to int64 pandas 
Python :: sklearn.utils.bunch to dataframe 
Python :: hwo much does mano house cost in python 
Python :: python current date 
Python :: python windows hide files 
Python :: clear screen python 
Python :: standardscaler into df data frame pandas 
Python :: python 3 pm2 
Python :: python rename file 
Python :: Update all packages using pip on Windows 
Python :: python get time of day 
Python :: how to delete na values in a dataframe 
Python :: python initialize multidimensional list 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =