Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

xgb model prediction changes if i save and load the model

import pickle
file_name = "xgb_reg.pkl"

# save
pickle.dump(xgb_model, open(file_name, "wb"))

# load
xgb_model_loaded = pickle.load(open(file_name, "rb"))

# test
ind = 1
test = X_val[ind]
xgb_model_loaded.predict(test)[0] == xgb_model.predict(test)[0]

Out[1]: True
Comment

PREVIOUS NEXT
Code Example
Python :: Insertion Sorting using while in python 
Python :: flassger 
Python :: restrict memory use python code 
Python :: pyttsx3 listen to events 
Python :: python case sensitive when dealing with identifiers 
Python :: python get currentmonth 
Python :: asterisk triangle print 
Python :: Find Factors of a Number Using for Loop 
Python :: Flatten List in Python Using NumPy Ravel 
Python :: List Comprehension simple example 
Python :: extract tables from image python 
Python :: unique character 02 
Python :: pass method 
Python :: pandas version for python 3.9 
Python :: python create empty list with size 10 
Python :: python jupyter show cell execution progress bar 
Python :: python evenly spaced integers 
Python :: Python NumPy atleast_2d Function Syntax 
Python :: how to shuffle list in djnago 
Python :: Set changed size during iteration 
Python :: Python NumPy hstack Function Example with 1d array 
Python :: How can I Duplicate 1 Dimensional array 
Python :: python __div__ 
Python :: NumPy bitwise_and Example When inputs are numbers 
Python :: NumPy bitwise_or Code When inputs are arrays 
Python :: save axis and insert later 
Python :: how to calculate iqr in pandas 
Python :: python call c function 
Python :: python raw strings 
Python :: ternary operator in list comprehension python 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =