Skip to content

Commit c6575ed

Browse files
authored
Merge pull request #614 from JuliaAI/dev
For a 0.18.5 release
2 parents 5f995f5 + a09119f commit c6575ed

9 files changed

Lines changed: 4727 additions & 4642 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "monthly"
8+
- package-ecosystem: "julia"
9+
directories: # Location of Julia projects
10+
- "/"
11+
schedule:
12+
interval: "weekly"

.github/workflows/CompatHelper.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
arch:
2525
- x64
2626
steps:
27-
- uses: actions/checkout@v2
28-
- uses: julia-actions/setup-julia@v1
27+
- uses: actions/checkout@v6
28+
- uses: julia-actions/setup-julia@v2
2929
with:
3030
version: ${{ matrix.version }}
3131
arch: ${{ matrix.arch }}
32-
- uses: julia-actions/cache@v1
32+
- uses: julia-actions/cache@v3
3333
env:
3434
cache-name: cache-artifacts
3535
with:
@@ -45,7 +45,7 @@ jobs:
4545
# This environment variable enables the integration tests:
4646
MLJ_TEST_REGISTRY: "false"
4747
- uses: julia-actions/julia-processcoverage@v1
48-
- uses: codecov/codecov-action@v4
48+
- uses: codecov/codecov-action@v6
4949
with:
5050
token: ${{ secrets.CODECOV_TOKEN }}
5151
fail_ci_if_error: false

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MLJModels"
22
uuid = "d491faf4-2d78-11e9-2867-c94bc002c0b7"
33
authors = ["Anthony D. Blaom <anthony.blaom@gmail.com>"]
4-
version = "0.18.4"
4+
version = "0.18.5"
55

66
[deps]
77
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"

src/builtins/ThresholdPredictors.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,14 @@ function MMI.fitted_params(model::ThresholdUnion, fitresult)
245245
)
246246
end
247247

248+
# to strip off any "report" part of the atomic model's output of `predict`:
249+
prediction_part(output, atomic_model) =
250+
prediction_part(output, Val(:predict in MMI.reporting_operations(atomic_model)))
251+
prediction_part(output, ::Val{true}) = first(output)
252+
prediction_part(output, ::Val{false}) = output
253+
248254
function MMI.predict(model::ThresholdUnion, fitresult, X)
249-
yhat = MMI.predict(model.model, fitresult[1], X)
255+
yhat = prediction_part(MMI.predict(model.model, fitresult[1], X), model.model)
250256
threshold = (1 - fitresult[2], fitresult[2])
251257
return _predict_threshold(yhat, threshold)
252258
end

src/registry/Metadata.toml

Lines changed: 4670 additions & 4596 deletions
Large diffs are not rendered by default.

src/registry/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ MLJGLMInterface = "caf8df21-4939-456d-ac9c-5fefbfb04c0c"
1818
MLJIteration = "614be32b-d00c-4edb-bd02-1eb411ab5e55"
1919
MLJLIBSVMInterface = "61c7150f-6c77-4bb1-949c-13197eac2a52"
2020
MLJLinearModels = "6ee0df7b-362f-4a72-a706-9e79364fb692"
21-
MLJModelRegistryTools = "0a96183e-380b-4aa6-be10-c555140810f2"
2221
MLJModels = "d491faf4-2d78-11e9-2867-c94bc002c0b7"
2322
MLJMultivariateStatsInterface = "1b6a4a23-ba22-4f51-9698-8599985d3728"
2423
MLJNaiveBayesInterface = "33e4bacb-b9e2-458e-9a13-5d9a90b235fa"

test/builtins/ThresholdPredictors.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,21 @@ end
323323
@test MLJBase.predict(mach2, (; x = rand(2))) == yhat
324324
end
325325

326+
@testset "wrapping models with non-empty `reporting_observations`" begin
327+
# to resolve https://github.com/JuliaAI/MLJModels.jl/issues/606
328+
329+
X = (x = rand(3),)
330+
y = coerce([0, 1, 0], OrderedFactor)
331+
mode_class = y[1] # `0`
332+
333+
clf = ConstantClassifier()
334+
pipe = Standardizer() |> clf
335+
point_predictor = BinaryThresholdPredictor(pipe)
336+
337+
mach = MLJBase.machine(point_predictor, X, y) |> MLJBase.fit!
338+
@test MLJBase.predict(mach, X) == fill(mode_class, 3)
339+
end
340+
326341
end # module
327342

328343
true

test/runtests.jl

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,28 @@ import Pkg
22

33
using Test, MLJModels, MLJTransforms
44

5-
@testset "metadata" begin
6-
@testset "metadata.jl" begin
7-
@test include("metadata.jl")
8-
end
9-
@testset "model search" begin
10-
@test include("model_search.jl")
11-
end
12-
@testset "loading model code" begin
13-
@test include("loading.jl")
14-
end
15-
end
16-
17-
@testset "built-in models" begin
18-
@testset "Constant.jl" begin
19-
@test include("builtins/Constant.jl")
20-
end
21-
@testset "ThresholdPredictors" begin
22-
@test include("builtins/ThresholdPredictors.jl")
23-
end
24-
end
5+
test_files = [
6+
"metadata.jl",
7+
"model_search.jl",
8+
"loading.jl",
9+
joinpath("builtins", "Constant.jl"),
10+
joinpath("builtins", "ThresholdPredictors.jl"),
11+
]
2512

2613
if parse(Bool, get(ENV, "MLJ_TEST_REGISTRY", "false"))
27-
@testset "registry" begin
28-
@test include("registry.jl")
29-
end
14+
push!(test_files, "registry.jl")
3015
else
3116
@info "Test of the MLJ Registry is being skipped. Set environment variable "*
3217
"MLJ_TEST_REGISTRY = \"true\" to include them.\n"*
3318
"The Registry test takes about ten minutes. "
3419
end
20+
21+
files = isempty(ARGS) ? test_files : ARGS
22+
23+
for file in files
24+
quote
25+
@testset $file begin
26+
include($file)
27+
end
28+
end |> eval
29+
end

0 commit comments

Comments
 (0)