Skip to content

Conversation

achieveordie
Copy link
Collaborator

Reference Issues/PRs

Fixes #3372

What does this implement/fix? Explain your changes.

Migrate TapNet Network and Classifier from sktime-dl into sktime. Changes are kept to a minimum. Remove a few commented blocks of code. Ensure the addition of soft-dependency is handled appropriately.

Does your contribution introduce a new dependency? If yes, which one?

Yes, introduces keras-self-attention as a soft dependency.

What should a reviewer concentrate their feedback on?

  • Complete tapnet network
  • Complete tapnet classifier
  • Tested check_estimator() for tapnet network.
  • Tested check_estimator() for tapnet classifier. (currently failing)

Any other comments?

Currently, working on rectifying the problem and will ask to review the code when it is working locally.

PR checklist

For all contributions
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG] indicating whether the PR topic is related to enhancement, maintenance, documentation, or bug.
For new estimators
  • I've added the estimator to the online documentation.
  • I've updated the existing example notebooks or provided a new one to showcase how my estimator works.

@achieveordie
Copy link
Collaborator Author

Apart from the ongoing discussion on saving/loading of DL models (issue #3022). The reason current PR fails to even save from self.model_.save() is due to keras.layers.Lambda() which is incompatible with (de)serialization attempts.

I could subclass a layer instead of using a Lambda to avoid this issue(this is the suggested way as per the previous link).

@fkiraly If this seems like a reasonable change, let me know so I could start working on it.

@fkiraly
Copy link
Collaborator

fkiraly commented Sep 12, 2022

Currently, the two failing tests are being skipped for all DL models until a solution for the save/load issue is found.

You can add the network to the skip list in tests._config.

@achieveordie achieveordie marked this pull request as ready for review September 23, 2022 14:06
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question: how common is it to install keras-self-attention if you already have tensorflow or keras? Should this be a core dl dependency or just a soft dependency?

@achieveordie
Copy link
Collaborator Author

Quick question: how common is it to install keras-self-attention if you already have tensorflow or keras? Should this be a core dl dependency or just a soft dependency?

I'm aware there are other networks that make use of keras-self-attention in sktime, but I believe we do not need to have it as a core dl dependency yet. We could add it as so if we have more models that make use of it in the future. Personally, I've never used this myself and have seen it only a few times before this.

@fkiraly
Copy link
Collaborator

fkiraly commented Sep 23, 2022

ok, let's make it a soft dependency then

@achieveordie achieveordie requested review from fkiraly and removed request for aiwalter September 26, 2022 06:27
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Almost ready to go.

I think we need to:

  • add a check for the soft dependency at the top of the module (warning level)
  • add another check in the init (error level)

Have a look at MatrixProfileTransformer as an example.

@achieveordie
Copy link
Collaborator Author

I see I was missing a warning-level soft dependency check for the network. I've added that, I think it should be good now.

On a side note MatrixProfileTransformer has no explicit error-level check in the constructor. Should it be this way?

@fkiraly
Copy link
Collaborator

fkiraly commented Oct 2, 2022

On a side note MatrixProfileTransformer has no explicit error-level check in the constructor. Should it be this way?

Yes, it's done by the python_dependencies tag and super.__init__.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good now, thanks!

@fkiraly fkiraly merged commit 23d4185 into sktime:main Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:classification classification module: time series classification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] Adding TapNet DL Model for Classification
3 participants