Skip to content

Conversation

@janvanrijn
Copy link
Member

adds more documentation how to add extensions to OpenML Python

@janvanrijn janvanrijn requested a review from mfeurer May 12, 2021 15:28
Copy link
Collaborator

@mfeurer mfeurer left a 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. I have a few minor suggestions on how to improve it.

janvanrijn and others added 3 commits May 16, 2021 12:36
@janvanrijn janvanrijn requested a review from prabhant May 16, 2021 10:43
Copy link
Contributor

@prabhant prabhant left a comment

Choose a reason for hiding this comment

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

LGTM, A small change can be added too :)

etc) and that the chosen model will be inferred from the optimization trace.
* :meth:`check_if_model_fitted`: Check whether the train method of the model
has been called (and as such, whether the predict method can be used).
* Hyperparameter optimization (optional)
Copy link
Contributor

Choose a reason for hiding this comment

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

A small addition that can be added here is
The optional methods have to be initialized as an empty function example:
def instantiate_model_from_hpo_class():
"This is just an empty function to avoid errors"

It can be confusing for some users to get errors that this optional method is not implemented. So here we can add that though these methods are optional they should still be present in the extension as an empty function.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean exactly? I would just suggest users to raise a NotImplementedError (since that method will only be invoked externally)

Copy link
Contributor

Choose a reason for hiding this comment

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

In the end, you still need these optional methods to exist in the extension, While using the extension openml-python does require the optional methods to exist too(at least that was the issue I faced while developing openml-tensorflow). So I just defined the functions without definitions like here: https://github.com/openml/openml-tensorflow/blob/master/openml_tensorflow/extension.py

But it was confusing for me at first when I was getting those errors, so I think it will be helpful to add a message regarding that here(that we still need to define these methods as empty methods if we don't want to implement them).

Copy link
Member Author

Choose a reason for hiding this comment

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

In the end, you still need these optional methods to exist in the extension

Are you sure? Since the extensin inherits from the Extension interface, we technically do not need to implement it in the specific right?

Just to be sure, I added:

Note that although this method is optional, for the extension to work it
needs to exist. If this function is not required, we recommend to have an
empty function that raises a NotImplementedError with a useful error
message.


* General setup (required)
* :meth:`can_handle_flow`: Takes as argument an OpenML flow, and checks
whether this can be handled by the current extension. The OpenML database
Copy link
Collaborator

Choose a reason for hiding this comment

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

The docbuild fails because this indentation will lead to a warning (which we don't allow). In case you have issues building docs locally there's also a docker image available.

Copy link
Member Author

Choose a reason for hiding this comment

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

should I remove all line breaks?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Line breaks are OK, but it's indented too far for this parser. Content for the lists should only be indented as far as the asterisks (not sure why the parser wants this, to be honest).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a misleading error message. I added a line break and it now works. I created a commit which fixes doc building and will now create a commit fixing the merge conflicts arising from this.

Copy link
Collaborator

@PGijsbers PGijsbers left a comment

Choose a reason for hiding this comment

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

Looks good! There is one grammatical error (and two suggestions). But the docs currently don't build without warning because of the indentation.



this method also sets the hyperparameters of a model).
Note that although this method is optional, for the extension to work it
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it rather be that the implementing the logic is optional but that the function needs to exists? So

Note that although this method is required, it is not necessary to implement any logic if hyperparameter optimization is not implemented. Simply raise a `NotImplementedError` then.

@mfeurer mfeurer requested a review from PGijsbers May 18, 2021 16:15
@mfeurer mfeurer merged commit 79e647d into develop May 18, 2021
@mfeurer mfeurer deleted the extend_extensions_page branch May 18, 2021 17:42
PGijsbers added a commit to Mirkazemi/openml-python that referenced this pull request Feb 23, 2023
* started working on additional information for extension

* extended documentation

* final pass over extensions

* Update doc/extensions.rst

Co-authored-by: Matthias Feurer <[email protected]>

* Update doc/extensions.rst

Co-authored-by: Matthias Feurer <[email protected]>

* changes suggested by MF

* Update doc/extensions.rst

Co-authored-by: PGijsbers <[email protected]>

* Update doc/extensions.rst

Co-authored-by: PGijsbers <[email protected]>

* Update doc/extensions.rst

Co-authored-by: PGijsbers <[email protected]>

* added info to optional method

* fix documentation building

* updated doc

Co-authored-by: Matthias Feurer <[email protected]>
Co-authored-by: PGijsbers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants