Skip to content

Commit

Permalink
Merge pull request #7 from JuliaML/show
Browse files Browse the repository at this point in the history
Update FittedModel show
  • Loading branch information
juliohm authored Oct 20, 2023
2 parents 6c4515f + 9ad94ab commit 0afa972
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ struct FittedModel{M,C}
model::M
cache::C
end

Base.show(io::IO, ::FittedModel{M}) where {M} = print(io, "FittedModel{$(nameof(M))}")
8 changes: 7 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ const SLM = StatsLearnModels
output = iris[:, [:target]]
train, test = MLJ.partition(1:nrow(input), 0.7, rng=123)

@testset "interface" begin
@testset "show" begin
model = DecisionTreeClassifier()
fmodel = SLM.fit(model, input[train, :], output[train, :])
@test sprint(show, fmodel) == "FittedModel{DecisionTreeClassifier}"
end

@testset "models" begin
@testset "MLJ" begin
Random.seed!(123)
Tree = MLJ.@load(DecisionTreeClassifier, pkg = DecisionTree, verbosity = 0)
Expand Down

0 comments on commit 0afa972

Please sign in to comment.