-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUG] Fix BOSS based classifiers truncating class names to single character length #4096
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me - could you kindly add a test that certifies for the fix?
I.e., your example (as simple as possible, with dummy data) that fails before the fix and runs after?
It should go into the folder sktime.classification.dictionary_based
, in a new module test_boss.py
Let me know if you don't want to add that and/or need help with pytest
, best starting point is perhaps following the pattern in test_tde
(same folder)
Sure! Thanks for guiding me through this. Happy to learn new things! I will
try to add the unit test and submit again.
… Message ID: ***@***.***>
|
@fkiraly ,I need your help. How do I run the tests after writing them? Using
Output as follows
Appreciate your advice. Thanks. |
To run the test in, say, Two common options are:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great!
Will merge once tests pass.
One tipp, but not a blocker - the tests are a bit repetitive, and they could be made much less copy-paste by using pytest
mark.parametrize
(on pairs of the expected y_pred.dtype
, and the new_class
dict values).
Feel free to try changing that (you can do it in this PR or a separate one once this is merged), as said it´s not necessary for this to go in imo.
Ah, but linting is failing now :-) |
just fixed the linting so we can potentially put this fix in the release |
I see there's another issue. Let me clear it on my end first. I have actually installed Black locally, but I guess it didn't catch the particular portion which failed. Will try and install pre-commit |
Yes, it wants you to write docstrings for the tests. Minimal ones have one line, better ones have an explanation of what precisely the test success and fail conditions are. |
@fkiraly, I've managed to install pre-commit locally already and it has passed all the test. Please review again. Thank you |
linting passes now! 🎉 |
Thanks a lot for your guidance. I'll work on improving the tests soon! |
…racter length (sktime#4096) Fixes sktime#4090 which prevents predicted classes list from being populated correctly When calling `np.zeros`, change `string` datatype to `object` so that `np.zeros` will not truncate the string to only the first character. I've also tested this locally using provided example in the issues as well as running `check_estimator(IndividualBOSS)`. All tests PASSED!
Reference Issues/PRs
This will fix #4090 which prevent predicted classes list from being populated correctly
What does this implement/fix? Explain your changes.
When calling
np.zeros
, changestring
datatype toobject
so that np.zeros will not truncate the string to only the first character.I've also tested this locally using provided example in the issues as well as running
check_estimator(IndividualBOSS)
. All tests PASSED!Does your contribution introduce a new dependency? If yes, which one?
No