Skip to content
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

Create BaseObject #877

Closed
RNKuhns opened this issue May 19, 2021 · 3 comments
Closed

Create BaseObject #877

RNKuhns opened this issue May 19, 2021 · 3 comments
Labels
API design API design & software architecture feature request New feature or request

Comments

@RNKuhns
Copy link
Contributor

RNKuhns commented May 19, 2021

Is your feature request related to a problem? Please describe.
Sktime's BaseEstimator inherits from scikit-learn's BaseEstimator and adds functionality for getting estimator tags and checking if an estimator has been fitted.

The functionality to check if an estimator is fitted (and the is_fitted property) are not needed for "non-fitable" Sktime classes (for instance performance_metrics). However, these Sktime would benefit from inheriting from a base Sktime object that includes the estimator tag functionality. Additionally, if these classes inherit from Sktime's BaseEstimator it causes problems for unit testing that is designed to test "fitable" estimators.

Describe the solution you'd like
Create an Sktime BaseObject class that inherits from scikit-learn's BaseEstimator and only adds the method for returning estimator tags.

Sktime's BaseEstimator can then inherit from the BaseObject and add the functionality that applies to estimators (e.g. is_fitted and check_is_fitted).

Add appropriate unit tests for BaseObject.

Describe alternatives you've considered
Primary alternative is to copy functionality needed functionality from BaseEstimator (e.g. #858), but inheriting the functionality is much cleaner and less error prone.

@RNKuhns RNKuhns added the feature request New feature or request label May 19, 2021
@mloning mloning added the API design API design & software architecture label May 19, 2021
@RNKuhns RNKuhns linked a pull request Jun 13, 2021 that will close this issue
5 tasks
@mloning
Copy link
Contributor

mloning commented Jul 2, 2021

From our discussion today @RNKuhns, functionality that the BaseObject and tests on it should cover:

  • tags
  • setting/inspection of hyper-parameters (get_params and set_params)
  • pretty printing (__repr__)
  • specification, constructor, saving hyper-parameters as immutable object attributes

Potential additional interface points:

  • scitype inspection (e.g. get_scitype() or is_scitype(<scitype>), what scitype the object is, e.g. a forecaster or classifier or something else)
  • object persistence (e.g. a save() method using pickling)

@fkiraly
Copy link
Collaborator

fkiraly commented Jul 17, 2021

BaseObject has now been added in #1134, though not all features are implemented above.

Perhaps it's time to close this and move additional desired interface points to a new issue and/or new discussion.

@RNKuhns
Copy link
Contributor Author

RNKuhns commented Jul 17, 2021

I think that sounds reasonable.

@RNKuhns RNKuhns closed this as completed Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API design API design & software architecture feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants