-
Notifications
You must be signed in to change notification settings - Fork 8
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
MrSQMClassifier
non-compliance with sktime
serialization interface
#7
Comments
Thanks @fkiraly, Re problem 1, I was actually able to pickle MrSQMClassifier, however, only if SFA is not used.
But this provoked the same TypeError
There is not much difference between the SAX and SFA Cython wrappers code so I suspect the problem is in the C++ code. |
Thanks for identifying the root cause. I patched over the two issues in sktime/sktime#4337 now, as a consequence you cannot retrieve fitted parameters or use It can be released that way and is scheduled for 0.17.0. We should leave this open until this is fixed in this package, and the two patches are removed in Patch revert needs to be applied in three places in
|
May I hand to you the reponsibility to maintain the (e.g., once you fix the interface non-compliance in |
I think speed is still sth you'd want to maintain. |
may I kindly ask if there are plans (if yes timeline) on resolving this? Need any help? |
? |
Hi @fkiraly , I just revisited this issue and found a solution. The problem is that MrSQMClassifier stores Cython objects (PySFA) that contain pointers. I made several attempts with the reduce function as well as getstate and setstate but couldn't make it work. The solution I found is that to only store the necessary information in a Python array and initiate the objects on the fly. This should work with pickle now. I also updated the Pypi package. On a different note, I also have put MrSEQL on Pypi (https://pypi.org/project/mrseql/). |
Great! Apologies for the late reply.
Ok, that should work - I'll try to remove the patch, lower bound the required Reference issue: sktime/sktime#4396
Excellent! The How do we proceed with this? I think there are still users who'd like this back. It should be easy to whip up an interface to make it searchable in Update: naive replication of |
@lnthach, quick question: have you addressed both problem 1 (pickle) and 2 (parameters), or only problem 1? By intention, I mean. |
Looks like the pickling bug is fixed! This unlocks further tests, which seem to indicate there is an issue with the |
I only addressed problem 1. Re problem 2 sorry if it's a silly question, what need to be done to fix this problem ? |
Your estimator has to implement a method The "quickest" fix would be to add this method to the class: def get_fitted_params(self):
return {} though of course you may like to return fitted parameters to show to the user if there are any of interest. |
…pstream bugfix (#5171) Upstream issues re persistence of `MrSQM` have been fixed in version `0.0.5` of `mrsqm`, see #4396 and mlgig/mrsqm#7 (comment). This PR adds back the `nsfa>0` test case and removes the warning from the docstring.
@lnthach, @heerme, I've tried integrating
MrSQM
to distribute it withsktime
(by interface to this package), also as a proof-of-concept of how we could back-integrateMrSEQL
.Issue for
MrSQM
: sktime/sktime#4338Issue for
MrSEQL
: sktime/sktime#4296The PR sktime/sktime#4337 works in that it proves that we can integrate cython based estimators with
sktime
tests and the up-to-date framework, if those estimators are in an external package such asmrsql
(this one).Now, with the tests working, it would appear that
MrSQM
is failing two contract tests:_get_fitted_params
, fitted parameter inspectionI assume the same tests would fail if you run
check_estimator
, i.e.,How do we proceed from here?
Problem 1: serialization
I'm not too familiar with cython, the exception when serializing (saving to binary) is
TypeError: no default __reduce__ due to non-trivial __cinit__
To make it work, I suspect one would have to implement serialization via the higher-level interface (
save
andload
) or via the lower-level interface,__reduce__
. @achieveordie has done that previously for classes of estimators, maybe he has more insight.To provoke the error without the test suite, do
pickle(my_estimator)
on a fitted instance ofMrSQMClassifier
(that should work without complaining for an easy solution via the lower-level interface).Problem 2: fitted parameters
The other issue is
get_fitted_params
, this should be implemented either directly or via inheritance fromBaseClassifier
- that can be solved on thesktime
side though.The text was updated successfully, but these errors were encountered: