Skip to content

[ENH] Migrating Estimators from sktime-dl #3351

@AurumnPegasus

Description

@AurumnPegasus

Is your feature request related to a problem? Please describe.
Related to the task of migrating estimators from sktime-dl to sktime. The main goal of doing so is to have all networks/models in a single package, following similar structure and quality.

Steps for Migration

Choose one of the Classifiers or Regressors from the list below, and create an issue for it.
There are 2 key components to a DL Estimator, the Network (creates the actual code of neural network) and the Estimator (Is a layer of abstraction to make the user's life easier).
Lets say I want to create CNNClassifier (steps are similar for any other DL Regressor or Classifier, whereever there are differences, I will mention them)

  1. Our first task would be to check if the network has already been implemented or not. Networks are often common for multiple estimators (for eg, CNNClassifier and CNNRegressor use the same CNNNetwork). So, I would check if a file named cnn.py exists in sktime/sktime/networks. If it does, that means that the network has already been made, and you can skip to the step to create the classifier.
  2. If the network has not been created, we need to create one. Create a file called cnn.py in sktime/sktime/networks. This file will contain our CNNNetwork. You will have to migrate the network from sktime-dl to sktime. To do so, you will need to go to sktime-dl/networks and look for _cnn.py
  3. Migrate this code from sktime-dl to sktime. An example of this migration is that the original code of _cnn.py from sktime dl has been migrated as cnn.py in sktime. The code, for most part, remains the same, with different documentation at most. There are a few cases where the migration is not as straightforward, and it would be described in the end.
  4. Ensure all the tests pass for the Network you created! Run the pytest, and then run the check_estimator tests as mentioned in the developer guide. Once all the tests pass, you have successfully migrated your Network.
  5. Now, to create an estimator, lets create a new file called cnn.py at sktime/sktime/classification/deep_learning/. You will be migrating the CNNClassifier here. You will have to migrate the network from sktime-dl to sktime. To do so, go to sktime-dl/classification and look for _cnn.py.
  6. Migrate this code from sktime-dl to sktime. An example of this migration is that the original code of _cnn.py from sktime-dl has been migrated as cnn.py in sktime. The code and core logic, for most part, remains the same. There are minor differences in _fit method you will need to take care of. For other cases where the migration is not as straightforward are described in the end.
  7. Ensure all the tests pass for the Estimator you created! (the steps here are the same as step 4, but for Classifier/Regressor instead of Network)

Special Cases

Adding Soft Dependancy
  1. In cases where the particular network/estimator requires an additional dependency, (for example, CNTCNetwork requires keras_self_attention), you have to add them as a soft dependancy
  2. Firstly, go to pyproject.toml, and check in the all_extras list whether the dependency you want to add (lets say keras_self_attention), already exists within it or not. IF it does, it means that it already is a soft dependancy, and you can skip the steps required to add it as a soft dep.
  3. To add a dependency as soft dependency, follow the instructions mentioned in the dev guide. You mostly will have to add it in the all_extras list of pyproject.toml.
  4. Next, we need to go to the classes where we need to use the soft dep, and add a check for _check_soft_dependencies. An example for how it is done is there in CNTCNetwork

DL Classifiers:

DL Regressors:

Metadata

Metadata

Assignees

Labels

enhancementAdding new functionalitygood first issueGood for newcomersmodule:classificationclassification module: time series classificationmodule:regressionregression module: time series regression

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions