Closed MilesCranmer closed 8 months ago
You raise a good question here. Currently we have a plot recipe for machines bound to TunedModel
s; see here, but this happens in MLJTuning which already has MLJBase as a dep. This was probably an unfortunate design.
I hadn't thought of adding an AbstractMachine
type to MLJModelInterface. I tend to think of machines as a completely separate, higher level interface. Another idea is to implement your recipe for thefitresult
returned by your implementation of MLJModelInterface.fit
(in SymbolicRegression.jl) and we add a generic overloading of plot recipes for machines in MLJBase; something like:
PlotRecipes.plot(mach::Machine) = plot(machine.fitresult)
What do you think?
I hadn't thought of adding an
AbstractMachine
type to MLJModelInterface. I tend to think of machines as a completely separate, higher level interface. Another idea is to implement your recipe for thefitresult
returned by your implementation ofMLJModelInterface.fit
(in SymbolicRegression.jl) and we add a generic overloading of plot recipes for machines in MLJBase; something like:PlotRecipes.plot(mach::Machine) = plot(machine.fitresult)
What do you think?
That’s a good way to do it! I would be quite content with this.
Quick addendum: I think it should instead be:
@recipe function default_machine_plot(mach::Machine)
mach.fitresult
end
which is the idiomatic way to do it https://docs.juliaplots.org/latest/RecipesBase/syntax/ and will automatically forward all plotting information.
And it should be RecipesBase
which is the interface package (rather than PlotRecipes
)
Hey all,
I want to create a default
plot
interface for a fitted regressor in SymbolicRegression.jl. However I'm not sure what type to write it for. Is there a good abstract type I can specialize to for creating plots?e.g.,
I would like to create a method for
One way is by creating an extension to
MLJBase
but I'm wondering if there's just an abstract type for, say,AbstractMachine{SRRegressor}
.Cheers, Miles