Skip to main content
deleted 63 characters in body
Source Link
ashu
  • 489
  • 2
  • 5
  • 13

I have trained scikit learn model and now I want to use in my python code. Is there a way I can re-use the same model instance? In a simple way, I can load the model again whenever I need it, but as my needs are more frequent I want to load the model once and reuse it again.

Is there a way I can achieve this in python?

Here is the code for one thread in prediction.py:

modelclf = graphlabjoblib.load_modelload(modellocation'trainedsgdhuberclassifier.pkl') # Takes a lot of time
recommendations = modelclf.recommendpredict([userid],k=20,exclude_known=Falseuserid)

Now for another user I don't want to initiate prediction.py again and spend time in loading the model. Is there a way, I can simply write.

new_recommendations = prediction(userid)

Is it multiprocessing that I should be using here? I am not sure !!

I have trained scikit learn model and now I want to use in my python code. Is there a way I can re-use the same model instance? In a simple way, I can load the model again whenever I need it, but as my needs are more frequent I want to load the model once and reuse it again.

Is there a way I can achieve this in python?

Here is the code for one thread in prediction.py:

model = graphlab.load_model(modellocation) # Takes a lot of time
recommendations = model.recommend([userid],k=20,exclude_known=False)

Now for another user I don't want to initiate prediction.py again and spend time in loading the model. Is there a way, I can simply write.

new_recommendations = prediction(userid)

Is it multiprocessing that I should be using here? I am not sure !!

I have trained scikit learn model and now I want to use in my python code. Is there a way I can re-use the same model instance? In a simple way, I can load the model again whenever I need it, but as my needs are more frequent I want to load the model once and reuse it again.

Is there a way I can achieve this in python?

Here is the code for one thread in prediction.py:

clf = joblib.load('trainedsgdhuberclassifier.pkl')
clf.predict(userid)

Now for another user I don't want to initiate prediction.py again and spend time in loading the model. Is there a way, I can simply write.

new_recommendations = prediction(userid)

Is it multiprocessing that I should be using here? I am not sure !!

added 451 characters in body
Source Link
ashu
  • 489
  • 2
  • 5
  • 13

I have trained scikit learn model and now I want to use in my python code. Is there a way I can re-use the same model instance? In a simple way, I can load the model again whenever I need it, but as my needs are more frequent I want to load the model once and reuse it again.

Is there a way I can achieve this in python?

Here is the code for one thread in prediction.py:

model = graphlab.load_model(modellocation) # Takes a lot of time
recommendations = model.recommend([userid],k=20,exclude_known=False)

Now for another user I don't want to initiate prediction.py again and spend time in loading the model. Is there a way, I can simply write.

new_recommendations = prediction(userid)

Is it multiprocessing that I should be using here? I am not sure !!

I have trained scikit learn model and now I want to use in my python code. Is there a way I can re-use the same model instance? In a simple way, I can load the model again whenever I need it, but as my needs are more frequent I want to load the model once and reuse it again.

Is there a way I can achieve this in python?

I have trained scikit learn model and now I want to use in my python code. Is there a way I can re-use the same model instance? In a simple way, I can load the model again whenever I need it, but as my needs are more frequent I want to load the model once and reuse it again.

Is there a way I can achieve this in python?

Here is the code for one thread in prediction.py:

model = graphlab.load_model(modellocation) # Takes a lot of time
recommendations = model.recommend([userid],k=20,exclude_known=False)

Now for another user I don't want to initiate prediction.py again and spend time in loading the model. Is there a way, I can simply write.

new_recommendations = prediction(userid)

Is it multiprocessing that I should be using here? I am not sure !!

Source Link
ashu
  • 489
  • 2
  • 5
  • 13

Is it possible to load the model once and reuse it again in python?

I have trained scikit learn model and now I want to use in my python code. Is there a way I can re-use the same model instance? In a simple way, I can load the model again whenever I need it, but as my needs are more frequent I want to load the model once and reuse it again.

Is there a way I can achieve this in python?