Skip to content

Commit

Permalink
Merge pull request #761 from JuliaAI/dev
Browse files Browse the repository at this point in the history
For a 0.20.1 release
  • Loading branch information
ablaom authored Apr 21, 2022
2 parents e66b877 + 8d0bd52 commit aa208e9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MLJBase"
uuid = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
authors = ["Anthony D. Blaom <[email protected]>"]
version = "0.20.0"
version = "0.20.1"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
8 changes: 4 additions & 4 deletions src/machines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -769,14 +769,15 @@ Returns a shallow copy of the machine to make it serializable. In particular,
all training data is removed and, if necessary, learned parameters are replaced
with persistent representations.
Any general purpose Julia serialization may be applied to the output of
Any general purpose Julia serializer may be applied to the output of
`serializable` (eg, JLSO, BSON, JLD) but you must call `restore!(mach)` on
the deserialised object `mach` before using it. See the example below.
If using Julia's standard Serialization library, a shorter workflow is
available using the [`save`](@ref) method.
A machine returned by serializable is characterized by the property `mach.state == -1`.
A machine returned by `serializable` is characterized by the property
`mach.state == -1`.
### Example using [JLSO](https://invenia.github.io/JLSO.jl/stable/)
Expand Down Expand Up @@ -860,8 +861,7 @@ supported) using the Serialization module.
To serialise using a different format, see [`serializable`](@ref).
Machines are deserialized using the `machine` constructor as shown in
the example below. Data (or nodes) may be optionally passed to the
constructor for retraining on new data using the saved model.
the example below.
> The implementation of `save` for machines changed in MLJ 0.18
> (MLJBase 0.20). You can only restore a machine saved using older
Expand Down
6 changes: 4 additions & 2 deletions src/resampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ struct.
machine `mach` training in resampling - one machine per train/test
pair.
- `train_test_rows`: a vector of tuples, each of the form `(train, test)`, where `train` and `test`
are vectors of row (observation) indices for training and evaluation respectively.
"""
struct PerformanceEvaluation{M,
Measurement,
Expand Down Expand Up @@ -538,7 +540,7 @@ function Base.show(io::IO, ::MIME"text/plain", e::PerformanceEvaluation)
"with these fields:")
println(io, " measure, measurement, operation, per_fold,\n"*
" per_observation, fitted_params_per_fold,\n"*
" report_per_fold, train_test_pairs")
" report_per_fold, train_test_rows")
println(io, "Extract:")
show_color = MLJBase.SHOW_COLOR
color_off()
Expand Down Expand Up @@ -617,7 +619,7 @@ function _check_measure(measure, operation, model, y)

end

_check_measures(measures, operations, model, y) = begin
function _check_measures(measures, operations, model, y)
all(eachindex(measures)) do j
_check_measure(measures[j], operations[j], model, y)
end
Expand Down
18 changes: 18 additions & 0 deletions test/resampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -766,5 +766,23 @@ end
measures=[LogLoss(), BrierScore()], verbosity=0)
end

@testset "reported fields in documentation" begin
# Using `evaluate` to obtain a `PerformanceEvaluation` object.
clf = ConstantClassifier()
X, y = make_moons(100)
evaluations = evaluate(clf, X, y, resampling=CV())
T = typeof(evaluations)
@test T <: PerformanceEvaluation

show_text = sprint(show, MIME"text/plain"(), evaluations)
docstring_text = string(@doc(PerformanceEvaluation))
for fieldname in fieldnames(PerformanceEvaluation)
@test contains(show_text, string(fieldname))
# string(text::Markdown.MD) converts `-` list items to `*`.
@test contains(docstring_text, " * `$fieldname`")
end
end

#end
true

0 comments on commit aa208e9

Please sign in to comment.