8000 [ENH] Link to docs in object's html repr by mateuszkasprowicz · Pull Request #6876 · sktime/sktime · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[ENH] Link to docs in object's html repr #6876

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

Merged

Conversation

mateuszkasprowicz
Copy link
Contributor
@mateuszkasprowicz mateuszkasprowicz commented Aug 2, 2024

Reference Issues/PRs

Implements #6812

Depends on #6882 for the css fix

What does this implement/fix? Explain your changes.

  • Adds a (?) icon with a link to docs to object's html representation
  • Updates the html repr CSS style

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

No

What should a reviewer concentrate their feedback on?

  • Naming conventions I used

Did you add any tests for the change?

Yes

Any other comments?

  • _estimator_html_repr.py is based on skbase with doc link added based on sklearn
  • _estimator_html_repr.py is based on sklearn with "fitted" classes removed as we don't use "fitted" indicator in html repr

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the 8000 sktime root directory (not the CONTRIBUTORS.md). Common badges: code - fixing a bug, or adding code logic. doc - writing or improving documentation or docstrings. bug - reporting or diagnosing a bug (get this plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • Optionally, for added estimators: I've added myself and possibly to the maintainers tag - do this if you want to become the owner or maintainer of an estimator you added.
    See here for further details on the algorithm maintainer role.
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

@fkiraly
Copy link
Collaborator
fkiraly commented Aug 2, 2024

hm, doc build appears to be failing - looks like circular imports to me

@fkiraly
Copy link
Collaborator
fkiraly commented Aug 3, 2024

FYI, if you want to override, you need to inherit

class BaseObject(_HTMLDocumentationLinkMixin, _BaseObject),

and not class BaseObject(_BaseObject, _HTMLDocumentationLinkMixin)

because the MRO puts earlier parent classes at the last overrides.

Changed, to see what that does.

@fkiraly
Copy link
Collaborator
fkiraly commented Aug 3, 2024

strange, it does not seem to find the css file?

@mateuszkasprowicz
Copy link
Contributor Author

FYI, if you want to override, you need to inherit

class BaseObject(_HTMLDocumentationLinkMixin, _BaseObject),

and not class BaseObject(_BaseObject, _HTMLDocumentationLinkMixin)

because the MRO puts earlier parent classes at the last overrides.

Changed, to see what that does.

good catch, thx

@fkiraly fkiraly added enhancement Adding new functionality module:base-framework BaseObject, registry, base framework labels Aug 4, 2024
@fkiraly
Copy link
Collaborator
fkiraly commented Aug 4, 2024

restarted tests

@yarnabrina
Copy link
Member

@fkiraly any idea why is CI proceeding to schedule so many jobs, as initial ones failed?

@fkiraly
Copy link
Collaborator
fkiraly commented Aug 4, 2024

The reason is that most jobs are gated behind test-nosoftdeps rather than test-nodevdeps, and the latter is failing.

It is in general unusual that tests are failing in this combination, i.s., test-nosoftdeps runs while test-nodevdeps fails. Very peculiar, and both myself and @mateuszkasprowicz are unable to reproduce the failures locally, too.

step 1: Revert change from .css to _css
step 2: include css files as part of package
@yarnabrina yarnabrina force-pushed the link-to-docs-from-estimator-repr branch from 53eb5c7 to c588bde Compare August 4, 2024 12:07
@yarnabrina
Copy link
Member
yarnabrina commented Aug 4, 2024

I pushed an attempted fix, hopefully you don't mind. I request you to kindly review and revert if not working and/or incorrect.

This is my hypothesis:

  1. You are testing locally with editable install, so site-packages is not being used. CI does not do editable install, so what goes as part of package matters.
  2. CSS or any non-python files are not going into packages, unless you explicitly configure them. So they were missing in CI, but was working fine locally.

@mateuszkasprowicz I suggest you to test locally in a new environment where sktime is not installed as editable from a working directory that is outside your local clone. If my attempt fails, I think debugging that way will identify the real issue.

@fkiraly
Copy link
Collaborator
fkiraly commented Aug 4, 2024
  • the new failures are related to pyproject parsing. I fixed an issue there, and merged the fix into this.
  • what I am now wondering about, why does the failure related to the missing css not occur in all the other test cases? We should ensure we run code that requires the css to be present.

@fkiraly
Copy link
Collaborator
fkiraly commented Aug 4, 2024

The failures are unrelated, they seem to be caused by this: #6884

@mateuszkasprowicz mateuszkasprowicz marked this pull request as ready for review August 5, 2024 17:47
fkiraly
fkiraly previously approved these changes Aug 6, 2024
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.

Works for me, brilliant! I tested this with various estimators, and composites such as ForecastingPipeline and DirectReductionForecaster.

Two issues that came up and I think we ought to address:

  1. Pipelines render left-to-right rather than top-to-bottom.

I am not sure how to fix this, the best would be to add a tag that somehow controls this for a given composite. See display below for the ForecastingPipeline.
image

However, this is not something new and has already been like this for the old html display.

  1. The html display is no longer cross-compatible with the previous one, so estimator composites out of the two will not render.

An example of this is the following estimator composite which has an sklearn estimator inside an skpro estimator, inside an sktime estimator:

from sktime.forecasting.compose import DirectTabularRegressionForecaster
fs = DirectTabularRegressionForecaster.create_test_instances_and_names()
fs[0][2]

Interestingly, the sklearn estimator is displayed, but not the skpro estimator:
image

However, this also seems to be an issue with the old display, again not something introduced by this PR.

@fkiraly
Copy link
Collaborator
fkiraly commented Aug 6, 2024

Since these seem to be existing problems and not introdued or changed by this PR, moving them to a new issue: #6903

fkiraly
fkiraly previously approved these changes Aug 7, 2024
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.

I hope you don't mind, I tried to reduce coupling and make a future refactor upwards easier, by moving all new methods into the mixin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding new functionality module:base-framework BaseObject, registry, base framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0