JuliaAI / MLJBase.jl

Core functionality for the MLJ machine learning framework
MIT License
160 stars 45 forks source link

Forward `(::Machine).fitresult` to RecipesBase #951

Closed MilesCranmer closed 9 months ago

MilesCranmer commented 9 months ago

@ablaom

Apparently this is the idiomatic way to set up plotting recipes on custom types: https://docs.juliaplots.org/latest/RecipesBase/api/#RecipesBase.@recipe-Tuple{Expr}

With this change, a downstream package will be able to define:

@recipe function plot_my_regressor(fitresult::MyFitresultType)
    ...
end

and enable custom plotting of their fitted model.


Confirmed that this works for SymbolicRegression's regressors!


Fixes https://github.com/JuliaAI/MLJModelInterface.jl/issues/188

codecov[bot] commented 9 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (081fec8) 88.05% compared to head (ad03525) 87.95%.

Files Patch % Lines
src/plots.jl 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #951 +/- ## ========================================== - Coverage 88.05% 87.95% -0.10% ========================================== Files 27 28 +1 Lines 2519 2540 +21 ========================================== + Hits 2218 2234 +16 - Misses 301 306 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.