Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialization of sklearn regression trees from counting not compatible across versions #793

Closed
burcin opened this issue Jan 28, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@burcin
Copy link
Member

burcin commented Jan 28, 2014

scikit-learn versions shipped in the latest binaries for windows and osx/linux are different, 0.12.1 and 0.14.1 respectively. It seems that pickles created with these versions are not compatible.

This makes the ilastik project files saved from the counting workflow highly non portable. Not only can they not be opened with older/newer ilastik builds, but sharing between windows and osx/linux builds is not possible either.

We should handle the serialization of the sklearn regression trees manually to workaround this problem.

Here are the error messages:

Using sklearn-0.14.1 to open pickles from sklearn-0.12.1:

ERROR 2014-01-28 13:32:53,015 projectManager 23636 140735231054608 Project could not be loaded due to the following exception:
Traceback (most recent call last):
  File "/Applications/ilastik.app/Contents/Resources/lib/python2.7/ilastik/shell/projectManager.py", line 381, in _loadProject
  File "/Applications/ilastik.app/Contents/Resources/lib/python2.7/ilastik/applets/base/appletSerializer.py", line 825, in deserializeFromHdf5
  File "/Applications/ilastik.app/Contents/Resources/lib/python2.7/ilastik/applets/base/appletSerializer.py", line 559, in deserialize
  File "/Applications/ilastik.app/Contents/Resources/lib/python2.7/ilastik/applets/base/appletSerializer.py", line 225, in deserialize
  File "/Applications/ilastik.app/Contents/Resources/lib/python2.7/ilastik/applets/base/appletSerializer.py", line 576, in _deserialize
  File "/Applications/ilastik.app/Contents/Resources/lib/python2.7/ilastik/applets/counting/countingsvr.py", line 381, in load
  File "_tree.pyx", line 1282, in sklearn.tree._tree.Tree.__cinit__ (sklearn/tree/_tree.c:10342)
TypeError: ('__cinit__() takes exactly 8 positional arguments (11 given)', <type 'sklearn.tree._tree.Tree'>, (10, array([1], dtype=int32), 1, <sklearn.tree._tree.RegressionCriterion object at 0x100077480>, 50.0, 2, 1, 0.1, 10, 1, <mtrand.RandomState object at 0x10a55da08>))

Trying to load a project saved using a newer sklearn:

ERROR 2014-01-28 13:39:08,839 projectManager 1644 4972 Project could not 
be loaded due to the following exception:
Traceback (most recent call last):
   File 
"C:\softwares\ilastik_20140116\ilastik\ilastik\ilastik\shell\projectManager.py", 
line 381, in _loadProject
     item.deserializeFromHdf5(self.currentProjectFile, projectFilePath)
   File 
"C:\softwares\ilastik_20140116\ilastik\ilastik\ilastik\applets\base\appletSerializer.py", 
line 825, in deserializeFromHdf5
     ss.deserialize(topGroup)
   File 
"C:\softwares\ilastik_20140116\ilastik\ilastik\ilastik\applets\base\appletSerializer.py", 
line 559, in deserialize
     super(SerialCountingSlot, self).deserialize(group)
   File 
"C:\softwares\ilastik_20140116\ilastik\ilastik\ilastik\applets\base\appletSerializer.py", 
line 225, in deserialize
     self._deserialize(group[self.name], self.inslot)
   File 
"C:\softwares\ilastik_20140116\ilastik\ilastik\ilastik\applets\base\appletSerializer.py", 
line 576, in _deserialize
     forests.append(SVR.load(cachePath, targetname))
   File 
"C:\softwares\ilastik_20140116\ilastik\ilastik\ilastik\applets\counting\countingsvr.py", 
line 381, in load
     obj = cPickle.loads(dataset[0])
AttributeError: 'module' object has no attribute 'BestSplitter'
ERROR 2014-01-28 13:39:08,842 projectManager 1644 4972 Aborting Project 
@stuarteberg
Copy link
Member

It is nice to be able to reuse a classifier that has been previously saved, but nothing terrible will happen if the classifier is invalid and needs to be retrained. The user will have to wait while it retrains. I'll push a commit that simply warns the user and continues loading the rest of the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants