Skip to content

Commit

Permalink
refactor: remove unused printing
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Nov 9, 2024
1 parent bf05304 commit ef09e78
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 65 deletions.
4 changes: 0 additions & 4 deletions ext/SymbolicRegressionRecipesBaseExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ end

function default_sr_plot end

@recipe function default_sr_plot(fitresult::SRFitResult{<:SRRegressor})
return fitresult.state[2], fitresult.options
end

# TODO: Add variable names
@recipe function default_sr_plot(hall_of_fame::HallOfFame, @nospecialize(options::Options))
out = format_hall_of_fame(hall_of_fame, options)
Expand Down
26 changes: 26 additions & 0 deletions src/OptionsStruct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,32 @@ struct Options{
use_recorder::Bool
end

function Base.print(io::IO, @nospecialize(options::Options))
return print(
io,
"Options(" *
"binops=$(options.operators.binops), " *
"unaops=$(options.operators.unaops), "
# Fill in remaining fields automatically:
*
join(
[
if fieldname in (:optimizer_options, :mutation_weights)
"$(fieldname)=..."
else
"$(fieldname)=$(getfield(options, fieldname))"
end for
fieldname in fieldnames(Options) if fieldname [:operators, :nuna, :nbin]
],
", ",
) *
")",
)
end
function Base.show(io::IO, ::MIME"text/plain", @nospecialize(options::Options))
return Base.print(io, options)
end

specialized_options(options::AbstractOptions) = options
@unstable function specialized_options(options::Options)
return _specialized_options(options, options.operators)
Expand Down
60 changes: 0 additions & 60 deletions src/Printing.jl

This file was deleted.

1 change: 0 additions & 1 deletion src/SymbolicRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,6 @@ end

include("MLJInterface.jl")
using .MLJInterfaceModule: SRRegressor, MultitargetSRRegressor
include("Printing.jl")

# Hack to get static analysis to work from within tests:
@ignore include("../test/runtests.jl")
Expand Down

0 comments on commit ef09e78

Please sign in to comment.