-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[ENH] Changes to CNN Classifier #2991
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
Conversation
For the first task
Any idea exactly where should I place this utils function? |
For GPU functionality:
|
Update: I am also ignoring tests |
What is the problem with that test? |
The test uses pickle to save the model, and I think once we update the save function as per #3022 we can stop ignoring it.
|
Hey @fkiraly @TonyBagnall , |
re single test, for anyone who reads this, it was discussed on slack, and is related to the sporadic failure #2368 |
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 almost good to go to me!
I left some comments related to interface conformance, summary
and random_seed
. The rest is not blocking.
Also, question: can you explain why the test test_fit_does_not_overwrite_hyper_params
did not fail prior to this PR? Which change makes it fail? Perhaps that could be avoided somehow?
From what I know, it is because of specifying
On a bit of investigation, the error is when I use Adam (or any optimizer) and store it as a class variable. For example, in the current code I am doing Directly specifying the optimizer is not feasible, since we want to give the option to specify the optimizer to the user. Ofcourse, if instead of optimizer we were to directly take input of |
Ah, I see. An The test is failing correctly and pointing out that you are not interface compliant! Instead, write the optimizer to |
PS: generally, please do not except tests if are not sure what the tests are testing. Please remove the test skip again. |
@fkiraly |
Hey, before merging this I am planning to make a couple more design changes. I will formalise it in a bit, just informing so we dont merge this |
@fkiraly made some changes: Now, I am asking for them as input in self.label_encoder = self.label_encoder_
self.onehot_encoder = self.onehot_encoder_ In |
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!
Two comments:
- can you explain what purpose exposing the label and onehot encoder in the
__init__
serves? What would be a second example that makes sense here, i.e., another value that the user can pass? __init__
arguments should never be mutated. The lineself.label_encoder = self.label_encoder_
creates a (pointer) reference and not a copy, so callingfit_transform
on it will mutate the reference.
My essential idea was to allow for custom functions instead of the default one by |
Can you give two or three examples of intended usage here? Not sure whether I fully understand. |
Okay so i thought a bit about it and I was wrong, I do not think it is required: |
ok, also fine for me. I don't have an opinion either way, only applying the general principle that function or init args should be justified by at least two, optimally three different, meaningful examples of values/references that users may want to pass to them. |
Let me know when you think this is ready for another review. |
@fkiraly it is, have made the requested changes. |
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.
Great!
random_seed
should berandom_state
for consistency withsklearn
and the rest ofsktime
- we have already released
BaseDeepClassifier
with argsbatch_size
andrandom_state
, so should not remove them without deprecation
Things fixed:
- handling of
self.optimizer_
is good now! convert_y_to_keras
looks good now
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 now, thanks!
Reference Issues/PRs
Fixes #2935
What does this implement/fix? Explain your changes.
convert_y_to_keras
function inBaseDeepClassifier
into a utils functionlabel_encoder
andone hot encoder
to the user fromconvert_y_to_keras
(it can be useful for the users in case they want to use it to encode other data / or to decode data later on)use_bias
parameter to output layer. (simply as a customisation option to users, multiple linear layers are useful to create deeper networks depending on dataset / choice of activation function)lr
either within the optimiser or as parameter to the class itself.CNNClassifier
to specifyrandom seed
For all contributions