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(core): implement Recipe and Step printing #101

Merged
merged 5 commits into from
May 24, 2024

Conversation

deepyaman
Copy link
Collaborator

@deepyaman deepyaman commented May 17, 2024

To test:

>>> # Create test pipeline
>>> from sklearn.feature_selection import SelectKBest
>>> from sklearn.pipeline import Pipeline
>>> from sklearn.svm import SVC
>>> import ibis_ml as ml
>>> 
>>> imputer = ml.ImputeMean(ml.numeric())
>>> scaler = ml.ScaleStandard(ml.numeric())
>>> rec = ml.Recipe(imputer, scaler)
>>> subpipe = Pipeline(steps=[("select", SelectKBest(k=2)), ("svc", SVC())])
>>> pipe = Pipeline([("rec", rec), ("sub", subpipe)])
>>> 
>>> # Pretty-print pipeline
>>> from sklearn.utils._pprint import _EstimatorPrettyPrinter
>>> 
>>> # Default behavior (indent at name) looks OK
>>> pp = _EstimatorPrettyPrinter(compact=False, indent=1, indent_at_name=True)
>>> print(pp.pformat(pipe))
Pipeline(steps=[('rec',
                 Recipe(ImputeMean(numeric()), ScaleStandard(numeric()))),
                ('sub',
                 Pipeline(steps=[('select', SelectKBest(k=2)),
                                 ('svc', SVC())]))])
>>>
>>> # `indent_at_name=False` looks like it also works
>>> pp = _EstimatorPrettyPrinter(compact=False, indent=1, indent_at_name=False)
>>> print(pp.pformat(pipe))
Pipeline(steps=[('rec', Recipe(ImputeMean(numeric()), ScaleStandard(numeric()))),
        ('sub',
         Pipeline(steps=[('select', SelectKBest(k=2)), ('svc', SVC())]))])

@deepyaman deepyaman marked this pull request as ready for review May 17, 2024 06:16
@deepyaman deepyaman marked this pull request as draft May 17, 2024 06:16
@codecov-commenter
Copy link

codecov-commenter commented May 17, 2024

Codecov Report

Attention: Patch coverage is 65.97938% with 66 lines in your changes are missing coverage. Please review.

Project coverage is 84.61%. Comparing base (fabc3c4) to head (1379e3c).

Files Patch % Lines
ibis_ml/utils/_pprint.py 58.49% 66 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
- Coverage   86.36%   84.61%   -1.76%     
==========================================
  Files          23       25       +2     
  Lines        1658     1852     +194     
==========================================
+ Hits         1432     1567     +135     
- Misses        226      285      +59     

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

@deepyaman deepyaman marked this pull request as ready for review May 23, 2024 06:37
@deepyaman deepyaman requested a review from jitingxu1 May 23, 2024 06:37
@deepyaman deepyaman changed the title [WIP] feat(core): implement pretty-printing of Recipes feat(core): implement pretty-printing of Recipes May 23, 2024
@deepyaman deepyaman changed the title feat(core): implement pretty-printing of Recipes feat(core): implement Recipe and Step printing May 23, 2024
@deepyaman deepyaman requested a review from jcrist May 23, 2024 16:09
@deepyaman deepyaman self-assigned this May 23, 2024
@jitingxu1 jitingxu1 mentioned this pull request May 23, 2024
1 task
@deepyaman deepyaman force-pushed the feat/core/pretty-print-recipe branch from 81b5888 to 1379e3c Compare May 24, 2024 01:06
@deepyaman deepyaman merged commit 02485fd into ibis-project:main May 24, 2024
4 checks passed
@deepyaman deepyaman deleted the feat/core/pretty-print-recipe branch May 24, 2024 01:36
@deepyaman deepyaman mentioned this pull request Jul 1, 2024
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.

None yet

2 participants