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

Add report method for merging fit reports with operational reports #160

Merged
merged 23 commits into from
Oct 4, 2022

Conversation

ablaom
Copy link
Member

@ablaom ablaom commented Aug 30, 2022

In support of JuliaAI/MLJBase.jl#831.

A non-breaking enhancement.

In this PR we:

  • Add a new model method report(::Model, report_given_method) for combining the reports generated by a model's fit method, with reports generated by operations, such as predict. Here report_given_method is a dictionary of reports, keyed on methods as symbols (:fit, :predict, :transform, and so forth).
  • Bump the Julia requirement to 1.6

The docstring for the new method is copied below.

MLJModelInterface.report(model, report_given_method)

Merge the reports in the dictionary report_given_method into a single
property-accessible object. It is supposed that the keys of the dictionary are
:fit and the symbolic names of MLJModelInterface.jl operations, such as :predict or
:transform. Each value will be the report component returned by a training method
(fit or update) dispatched on the model type, in the case of :fit, or the
report component returned by an operation that supports reporting.

New model implementations

Overloading this method is optional, unless the model generates reports that are neither
named tuples nor nothing.
Assuming each dictionary value is a named tuple or nothing, the fallback returns the
usual named tuple merge of the dictionary values, ignoring any nothing values, and
assuming there are no conflicts between the keys of the dictionary values (the individual
reports). If there is a key conflict, all operation reports are first wrapped in a named
tuple of length one, as in (predict=predict_report,).
If any dictionary value is neither a named tuple nor nothing, it is first wrapped as
(report=value, ) before merging.

@ablaom ablaom marked this pull request as draft August 30, 2022 07:16
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2022

Codecov Report

Merging #160 (ed0fd8c) into dev (7cd0ecf) will decrease coverage by 0.05%.
The diff coverage is 84.21%.

@@            Coverage Diff             @@
##              dev     #160      +/-   ##
==========================================
- Coverage   88.75%   88.70%   -0.06%     
==========================================
  Files           8        8              
  Lines         329      354      +25     
==========================================
+ Hits          292      314      +22     
- Misses         37       40       +3     
Impacted Files Coverage Δ
src/metadata_utils.jl 98.36% <50.00%> (-1.64%) ⬇️
src/model_api.jl 77.77% <88.23%> (+17.77%) ⬆️
src/equality.jl 100.00% <0.00%> (ø)
src/model_def.jl 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ablaom ablaom marked this pull request as ready for review September 16, 2022 04:22
@ablaom
Copy link
Member Author

ablaom commented Sep 16, 2022

@OkonSamuel

src/metadata_utils.jl Outdated Show resolved Hide resolved
src/model_api.jl Outdated Show resolved Hide resolved
src/model_api.jl Outdated Show resolved Hide resolved
Copy link
Member

@OkonSamuel OkonSamuel left a comment

Choose a reason for hiding this comment

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

LGTM. Except for some questions I asked that needs to be addressed.

ablaom and others added 3 commits September 23, 2022 10:33
Co-authored-by: Okon Samuel <39421418+OkonSamuel@users.noreply.github.com>
@ablaom ablaom merged commit 90875b7 into dev Oct 4, 2022
This was referenced Oct 4, 2022
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