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

feat(metrics): add a classification metrics module #176

Merged
merged 2 commits into from
Dec 25, 2024

Conversation

IndexSeek
Copy link
Member

@IndexSeek IndexSeek commented Dec 8, 2024

I wanted to start making some progress on supporting a new ibis_ml.metrics
module might look like with the first pass to support classification metrics.

In this initial pass, the functions accept the y_pred and y_true as Ibis table
expression columns.

A few thoughts

  • Should we go ahead and try this with regression metrics? Or would it be okay
    to start with classification only as an "experimental" type of op.
  • Do we need a "metrics" folder that contains "regression" and "classification" files?
  • Is there a more effective way to test this than to compare it to scikit-learns metrics?

What could go wrong?

I anticipate the inputs are coming from the same table expression, although testing
this behavior (or at least documenting) with what happens with input from two different
table expressions would be necessary.

Resolves (partially) #174

Edit: As far as testing goes, I wonder if more precision might be necessary.

@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.49%. Comparing base (7d2d021) to head (2b57d2b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #176      +/-   ##
==========================================
+ Coverage   90.35%   90.49%   +0.14%     
==========================================
  Files          29       31       +2     
  Lines        2083     2114      +31     
==========================================
+ Hits         1882     1913      +31     
  Misses        201      201              

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

@deepyaman
Copy link
Collaborator

Sorry, I didn't see this earlier; will try to take a look soon!

Copy link
Collaborator

@deepyaman deepyaman left a comment

Choose a reason for hiding this comment

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

One functional request to not force compute; rest are quick nits!

ibis_ml/metrics.py Outdated Show resolved Hide resolved
ibis_ml/metrics.py Show resolved Hide resolved
ibis_ml/metrics.py Show resolved Hide resolved
ibis_ml/metrics.py Show resolved Hide resolved
ibis_ml/metrics.py Show resolved Hide resolved
ibis_ml/metrics.py Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
@IndexSeek
Copy link
Member Author

Thanks for your review and the suggestions. I think these were great and have added them all now.

I'm not sure what's going on with the build-docs check here, it seems the last time it succeeded it was using scikit-learn==1.5.2 and now it's using scikit-learn==1.6.0.

@deepyaman
Copy link
Collaborator

I'm not sure what's going on with the build-docs check here, it seems the last time it succeeded it was using scikit-learn==1.5.2 and now it's using scikit-learn==1.6.0.

Seems __sklearn_tags__ is new from scikit-learn/scikit-learn#29677; I'll have to look into it. Feel free to pin scikit-learn <1.6.0 for now in https://github.com/ibis-project/ibis-ml/blob/main/pyproject.toml#L23.

docs: apply proper spacing separation in docstrings

Co-authored-by: Deepyaman Datta <[email protected]>

feat: lazify classification metrics and clean tests
@IndexSeek
Copy link
Member Author

It's pinned now at <1.6.0 for the "doc" dependencies and the check is passing! ✅

@IndexSeek IndexSeek requested a review from deepyaman December 20, 2024 02:51
@deepyaman deepyaman changed the title feat: add metrics module with classification metrics feat(metrics): add a classification metrics module Dec 25, 2024
Copy link
Collaborator

@deepyaman deepyaman left a comment

Choose a reason for hiding this comment

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

LGTM!

@deepyaman deepyaman merged commit f59bd6f into ibis-project:main Dec 25, 2024
4 checks passed
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.

3 participants