Discussion:
[Scikit-learn-general] Sklearn joblib issue with custom analyzer
JAGANADH G
2013-01-15 12:51:31 UTC
Permalink
Hi All,
I was trying to save and load a model (Text Classificaion with SVM) using
joblib. In the Vectorizer I used a custom analyzer called
"my_analyzer".Whwn I am trying to load the model with joblib it gives the
following error. Is there any way to incude my custom analyzer to the saved
model.
joblib.load("Tw_SVM_Li.model")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/numpy_pickle.py",
line 418, in load
obj = unpickler.load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1126, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'my_analyzer'

Best regards
--
**********************************
JAGANADH G
http://jaganadhg.in
*ILUGCBE*
http://ilugcbe.org.in
Gilles Louppe
2013-01-15 12:55:08 UTC
Permalink
Hi,

Can you give use the full script that is used to load your model?

In that script, have you imported "my_analyzer"?

Best,

Gilles
Post by JAGANADH G
Hi All,
I was trying to save and load a model (Text Classificaion with SVM) using
joblib. In the Vectorizer I used a custom analyzer called "my_analyzer".Whwn
I am trying to load the model with joblib it gives the following error. Is
there any way to incude my custom analyzer to the saved model.
joblib.load("Tw_SVM_Li.model")
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/numpy_pickle.py",
line 418, in load
obj = unpickler.load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1126, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'my_analyzer'
Best regards
--
**********************************
JAGANADH G
http://jaganadhg.in
ILUGCBE
http://ilugcbe.org.in
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
JAGANADH G
2013-01-15 13:10:24 UTC
Permalink
Hi,
I tried the same and itworks.
imprted my_analzer first and loaded the model.
Cool.

Thanks for the support.
Post by Gilles Louppe
Hi,
Can you give use the full script that is used to load your model?
In that script, have you imported "my_analyzer"?
Best,
Gilles
Post by JAGANADH G
Hi All,
I was trying to save and load a model (Text Classificaion with SVM) using
joblib. In the Vectorizer I used a custom analyzer called
"my_analyzer".Whwn
Post by JAGANADH G
I am trying to load the model with joblib it gives the following error.
Is
Post by JAGANADH G
there any way to incude my custom analyzer to the saved model.
joblib.load("Tw_SVM_Li.model")
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/numpy_pickle.py",
Post by JAGANADH G
line 418, in load
obj = unpickler.load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1126, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'my_analyzer'
Best regards
--
**********************************
JAGANADH G
http://jaganadhg.in
ILUGCBE
http://ilugcbe.org.in
------------------------------------------------------------------------------
Post by JAGANADH G
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
--
**********************************
JAGANADH G
http://jaganadhg.in
*ILUGCBE*
http://ilugcbe.org.in
Loading...