Skip to content

Commit

Permalink
fix mlj doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
tiemvanderdeure committed Nov 26, 2024
1 parent ae39990 commit a7a15f8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/mlj_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,25 @@ MMI.metadata_model(
"""
$(MMI.doc_header(MaxnetBinaryClassifier))
The keywords `link`, and `clamp` are passed to [`Maxnet.predict`](@ref), while all other keywords are passed to [`maxnet`](@ref).
The keywords `link`, and `clamp` are passed to [`predict`](@ref), while all other keywords are passed to [`maxnet`](@ref).
See the documentation of these functions for the meaning of these parameters and their defaults.
# Example
```jldoctest

Check failure on line 53 in src/mlj_interface.jl

View workflow job for this annotation

GitHub Actions / Documentation

doctest failure in ~/work/Maxnet.jl/Maxnet.jl/src/mlj_interface.jl:53-68 ```jldoctest using MLJBase p_a, env = Maxnet.bradypus() mach = machine(MaxnetBinaryClassifier(features = "lqp"), env, categorical(p_a), scitype_check_level = 0) fit!(mach, verbosity = 0) yhat = MLJBase.predict(mach, env) yhat[1:5] # output 5-element UnivariateFiniteVector{Multiclass{2}, Bool, UInt32, Float64}: UnivariateFinite{Multiclass{2}}(false=>0.812, true=>0.188) UnivariateFinite{Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{Multiclass{2}}(false=>0.501, true=>0.499) UnivariateFinite{Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{Multiclass{2}}(false=>0.752, true=>0.248) ``` Subexpression: using MLJBase p_a, env = Maxnet.bradypus() mach = machine(MaxnetBinaryClassifier(features = "lqp"), env, categorical(p_a), scitype_check_level = 0) fit!(mach, verbosity = 0) yhat = MLJBase.predict(mach, env) yhat[1:5] Evaluated output: 5-element UnivariateFiniteVector{Multiclass{2}, Bool, UInt32, Float64}: UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.812, true=>0.188) UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.501, true=>0.499) UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.752, true=>0.248) Expected output: 5-element UnivariateFiniteVector{Multiclass{2}, Bool, UInt32, Float64}: UnivariateFinite{Multiclass{2}}(false=>0.812, true=>0.188) UnivariateFinite{Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{Multiclass{2}}(false=>0.501, true=>0.499) UnivariateFinite{Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{Multiclass{2}}(false=>0.752, true=>0.248) diff = Warning: Diff output requires color. 5-element UnivariateFiniteVector{Multiclass{2}, Bool, UInt32, Float64}: UnivariateFinite{Multiclass{2}}(false=>0.812, UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.812, true=>0.188) UnivariateFinite{Multiclass{2}}(false=>0.811, UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{Multiclass{2}}(false=>0.501, UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.501, true=>0.499) UnivariateFinite{Multiclass{2}}(false=>0.811, UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.811, true=>0.189) UnivariateFinite{Multiclass{2}}(false=>0.752, UnivariateFinite{ScientificTypesBase.Multiclass{2}}(false=>0.752, true=>0.248)
using Maxnet, MLJBase
using MLJBase
p_a, env = Maxnet.bradypus()
mach = machine(MaxnetBinaryClassifier(features = "lqp"), env, categorical(p_a))
fit!(mach)
mach = machine(MaxnetBinaryClassifier(features = "lqp"), env, categorical(p_a), scitype_check_level = 0)
fit!(mach, verbosity = 0)
yhat = MLJBase.predict(mach, env)
yhat[1:5]
# output
5-element UnivariateFiniteVector{Multiclass{2}, Bool, UInt32, Float64}:
UnivariateFinite{Multiclass{2}}(false=>0.812, true=>0.188)
UnivariateFinite{Multiclass{2}}(false=>0.811, true=>0.189)
UnivariateFinite{Multiclass{2}}(false=>0.501, true=>0.499)
UnivariateFinite{Multiclass{2}}(false=>0.811, true=>0.189)
UnivariateFinite{Multiclass{2}}(false=>0.752, true=>0.248)
```
"""
Expand Down

0 comments on commit a7a15f8

Please sign in to comment.