From ed22ed20587e263ab00fc6473ff6ab9dd03f9cda Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Sat, 27 Sep 2025 10:16:48 +1200 Subject: [PATCH 1/4] CategoricalArrays = "0.10" => CategoricalArrays = "1" --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9dbfe21..582b0d2 100644 --- a/Project.toml +++ b/Project.toml @@ -11,7 +11,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" [compat] -CategoricalArrays = "0.10" +CategoricalArrays = "1" DecisionTree = "0.12" MLJModelInterface = "1.5" Tables = "1.6" From d950f899e6e5a8ed91ab5e1dd6185403a0828e61 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Sat, 27 Sep 2025 10:17:31 +1200 Subject: [PATCH 2/4] rm old refs to `classes(` --- src/MLJDecisionTreeInterface.jl | 8 ++------ test/runtests.jl | 5 +++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/MLJDecisionTreeInterface.jl b/src/MLJDecisionTreeInterface.jl index cd5357b..d0e409e 100644 --- a/src/MLJDecisionTreeInterface.jl +++ b/src/MLJDecisionTreeInterface.jl @@ -23,10 +23,6 @@ end Base.show(stream::IO, c::TreePrinter) = print(stream, "TreePrinter object (call with display depth)") -function classes(y) - p = CategoricalArrays.pool(y) - [p[i] for i in 1:length(p)] -end # # DECISION TREE CLASSIFIER @@ -79,7 +75,7 @@ function MMI.fit( end # returns a dictionary of categorical elements keyed on ref integer: -get_encoding(classes_seen) = Dict(MMI.int(c) => c for c in classes(classes_seen)) +get_encoding(classes_seen) = Dict(MMI.int(c) => c for c in levels(classes_seen)) # given such a dictionary, return printable class labels, ordered by corresponding ref # integer: @@ -459,7 +455,7 @@ _columnnames(X, ::Val{false}) = Tables.columnnames(first(Tables.rows(X))) # for fit: MMI.reformat(::Classifier, X, y) = - (Tables.matrix(X), MMI.int(y), _columnnames(X), classes(y)) + (Tables.matrix(X), MMI.int(y), _columnnames(X), levels(y)) MMI.reformat(::Regressor, X, y) = (Tables.matrix(X), float(y), _columnnames(X)) MMI.selectrows(::TreeModel, I, Xmatrix, y, meta...) = diff --git a/test/runtests.jl b/test/runtests.jl index 7252294..9179dcd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,7 @@ using Test import CategoricalArrays import CategoricalArrays.categorical +import CategoricalArrays.levels using MLJBase using StableRNGs using Random @@ -48,7 +49,7 @@ stable_rng() = StableRNGs.StableRNG(123) Xraw, yraw = @load_iris X = Tables.matrix(Xraw); y = int(yraw); -_classes = MLJDecisionTreeInterface.classes(yraw) +_classes = levels(yraw) features = MLJDecisionTreeInterface._columnnames(Xraw) baretree = DecisionTreeClassifier(rng=stable_rng()) @@ -74,7 +75,7 @@ yhat = MLJBase.predict(baretree, fitresult, X); # check preservation of levels: yyhat = predict_mode(baretree, fitresult, X[1:3, :]) -@test MLJBase.classes(yyhat[1]) == MLJBase.classes(yraw) +@test MLJBase.levels(yyhat[1]) == MLJBase.levels(yraw) # check report and fitresult fields: @test Set([:classes_seen, :print_tree, :features]) == Set(keys(report)) From 0168a335b0e7f287428b77911a53b65a5f9981d7 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Sat, 27 Sep 2025 10:18:44 +1200 Subject: [PATCH 3/4] bump suppor for julia < 0.10 --- .github/workflows/ci.yml | 5 ++--- Project.toml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cac96ab..621c572 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,8 @@ jobs: fail-fast: false matrix: version: - - '1.6' + - '1.10' - '1' - - 'nightly' os: - ubuntu-latest arch: @@ -30,7 +29,7 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: julia-actions/cache@v2 env: cache-name: cache-artifacts with: diff --git a/Project.toml b/Project.toml index 582b0d2..cbd43bc 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,7 @@ CategoricalArrays = "1" DecisionTree = "0.12" MLJModelInterface = "1.5" Tables = "1.6" -julia = "1.6" +julia = "1.10" [extras] MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d" From 277bcffd54d7d8fe98a06f7d62578e281770eb2d Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Tue, 4 Nov 2025 12:28:12 +1300 Subject: [PATCH 4/4] bump 0.4.3 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index cbd43bc..554a425 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MLJDecisionTreeInterface" uuid = "c6f25543-311c-4c74-83dc-3ea6d1015661" authors = ["Anthony D. Blaom "] -version = "0.4.2" +version = "0.4.3" [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"