Skip to content

[DOC] Add usage examples to core function docstrings (Fixes #1538)#1689

Open
Abhishek9639 wants to merge 9 commits intoopenml:mainfrom
Abhishek9639:doc/add-usage-examples-to-core-docstrings
Open

[DOC] Add usage examples to core function docstrings (Fixes #1538)#1689
Abhishek9639 wants to merge 9 commits intoopenml:mainfrom
Abhishek9639:doc/add-usage-examples-to-core-docstrings

Conversation

@Abhishek9639
Copy link
Copy Markdown

@Abhishek9639 Abhishek9639 commented Feb 23, 2026

[DOC] Add usage examples to core function docstrings. Closes #1538

Metadata

Details

This PR adds usage examples to selected public core functions in the project
to improve developer experience and documentation clarity.

The following functions were updated with example usage sections:

  • get_dataset()
  • get_datasets()
  • get_task()
  • run_model_on_task()
  • get_suite()
  • get_study()
  • create_study()

Why this change is necessary:
Examples in docstrings help users understand how to use the functions directly
from IDE hover tooltips and improve auto-generated documentation.

Reproduction:
No bug reproduction is required. This is a documentation enhancement.

Additional Notes:
Only docstrings were modified. No functional code changes were made.

@Abhishek9639 Abhishek9639 force-pushed the doc/add-usage-examples-to-core-docstrings branch 2 times, most recently from 66b3fc9 to 7126344 Compare February 23, 2026 17:45
@Abhishek9639
Copy link
Copy Markdown
Author

Screenshot

Copy link
Copy Markdown
Collaborator

@geetu040 geetu040 left a comment

Choose a reason for hiding this comment

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

@Abhishek9639 Abhishek9639 force-pushed the doc/add-usage-examples-to-core-docstrings branch from c93d964 to 2e455d1 Compare February 23, 2026 18:17
@Abhishek9639
Copy link
Copy Markdown
Author

Abhishek9639 commented Feb 23, 2026

Hii @geetu040 and @fkiraly,
Fixed the code quality checks. All pre-commit checks are now passing.
Please review it.

Copy link
Copy Markdown
Collaborator

@geetu040 geetu040 left a comment

Choose a reason for hiding this comment

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

Really nice. Left comment for one example, otherwise looks all good and it covers all the mentioned functions in the issue.

- Use HistGradientBoostingClassifier instead of DecisionTreeClassifier
  (fixes ValueError with missing values in task 1)
- Remove .DS_Store
- Remove tests/files/misc/features_with_whitespaces.xml.pkl
@Abhishek9639 Abhishek9639 force-pushed the doc/add-usage-examples-to-core-docstrings branch from 5a8956d to c155709 Compare March 1, 2026 16:53
@Abhishek9639
Copy link
Copy Markdown
Author

@geetu040,
Addressed all feedback,
Fixed run_model_on_task example using HistGradientBoostingClassifier instead of DecisionTreeClassifier (it handles missing values natively, so no more ValueError: could not convert string to float) Removed .DS_Store and features_with_whitespaces.xml.pkl
If any further changes are needed, please let me know.
Please review

Copy link
Copy Markdown
Collaborator

@geetu040 geetu040 left a comment

Choose a reason for hiding this comment

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

@Abhishek9639
Copy link
Copy Markdown
Author

Abhishek9639 commented Mar 1, 2026

@geetu040,
Updated as suggested now using openml.tasks.get_task(6) with DecisionTreeClassifier. Also removed .DS_Store and features_with_whitespaces.xml.pkl as requested. All pre-commit checks are passing. Please review
If any other changes are needed. please let me know.
Thanks

Copy link
Copy Markdown
Collaborator

@geetu040 geetu040 left a comment

Choose a reason for hiding this comment

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

LGTM.

@fkiraly please merge.

Copy link
Copy Markdown
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.

One minor suggestion, otherwise LGTM.
Feel free to dismiss my review when the change is made.

@Abhishek9639
Copy link
Copy Markdown
Author

Hi @PGijsbers
Done. updated the description to "decision trees" as you suggested.
Let me know if it looks good.
Thanks

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 54.67%. Comparing base (e653ef6) to head (3f919ea).

Files with missing lines Patch % Lines
openml/runs/functions.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1689   +/-   ##
=======================================
  Coverage   54.67%   54.67%           
=======================================
  Files          63       63           
  Lines        5108     5108           
=======================================
  Hits         2793     2793           
  Misses       2315     2315           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Abhishek9639
Copy link
Copy Markdown
Author

Hi @PGijsbers,
The 2 failing CI checks (test_initialize_model_from_run and test_run_exists) seem to be pre-existing flaky tests sklearn flow parameter mismatches on the test server, not related to this PR's docstring change.
Thanks

@geetu040 geetu040 requested a review from PGijsbers April 8, 2026 02:34
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.

[DOC] Add Usage Examples to Core Function Docstrings

5 participants