From 9eb9b34c1c8c0ccc42343e7ff96e2067850636ab Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 28 Nov 2022 11:33:56 +1300 Subject: [PATCH 1/7] update tests to reflect breaking changes in test dep EvoTrees --- test/strategies/adaptive.jl | 2 +- test/strategies/basic.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/strategies/adaptive.jl b/test/strategies/adaptive.jl index 0de1a49..e9af7f5 100644 --- a/test/strategies/adaptive.jl +++ b/test/strategies/adaptive.jl @@ -89,7 +89,7 @@ for acceleration in modes tree = EvoTreeRegressor(rng=rng) r1 = range(tree, :max_depth; values=[3:7;]) - r2 = range(tree, :η; lower=-2, upper=0, scale=exp10) + r2 = range(tree, :eta; lower=-2, upper=0, scale=exp10) baseline_self_tuning_tree = TunedModel( model=tree, diff --git a/test/strategies/basic.jl b/test/strategies/basic.jl index 4d994d1..24b2377 100644 --- a/test/strategies/basic.jl +++ b/test/strategies/basic.jl @@ -25,7 +25,7 @@ for acceleration in (CPU1(), CPUProcesses(), CPUThreads()) tree = EvoTreeRegressor(rng=rng) r1 = range(tree, :max_depth; values=[3:7;]) - r2 = range(tree, :η; lower=-2, upper=0, scale=exp10) + r2 = range(tree, :eta; lower=-2, upper=0, scale=exp10) baseline_self_tuning_tree = TunedModel( model=tree, From 07af5fd88e9ed0da237df45aea28e43e62355ce6 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 28 Nov 2022 12:37:32 +1300 Subject: [PATCH 2/7] mark tests broken by Distributions 0.25.60 as broken --- test/parameters.jl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/parameters.jl b/test/parameters.jl index 16d6aa4..bb45c24 100644 --- a/test/parameters.jl +++ b/test/parameters.jl @@ -87,15 +87,20 @@ @test state.X ≈ hcat(Xs...) end + # Distributions 0.25.60 broke the tests marked broken below. Comment from @ablaom: I'd + # say tests that dependend on implementation details of Distributions are not good + # tests, and these should be replaced by more robust tests in the future. I'm guessing + # these are really just integration tests. TODO: fix these tests @testset "Retrieve parameters" begin rng = StableRNG(1234) ranges = [r1, (r2, Uniform), (r3, d3), r4] state = PSO.initialize(rng, ranges, n) PSO.retrieve!(rng, state) params = state.parameters - @test params[1] == ["a", "a", "c"] + @test_broken params[1] == ["a", "a", "c"] @test params[2] ≈ [553, 250, 375] - @test params[3] ≈ [3.9372495283243105, 3.6569395920512977, 3.6354556967115146] - @test params[4] ≈ [-0.8067647f0, 0.4209916f0, 0.6736019f0] + @test_broken @test params[3] ≈ + [3.9372495283243105, 3.6569395920512977, 3.6354556967115146] + @test_broken params[4] ≈ [-0.8067647f0, 0.4209916f0, 0.6736019f0] end end From 4c9a91fe243742f1e0132fc081c2a4e642dc0ec1 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 28 Nov 2022 12:38:09 +1300 Subject: [PATCH 3/7] extend MLJBase compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index d906d0a..1993616 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,6 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [compat] Distributions = "0.25" -MLJBase = "0.18, 0.19, 0.20" +MLJBase = "0.18, 0.19, 0.20, 0.21" MLJTuning = "0.6, 0.7" julia = "1.4" From 625a255a80f9c09a4a0f9b4b9565bc4cb7486ff4 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 28 Nov 2022 12:38:29 +1300 Subject: [PATCH 4/7] bump 0.1.3 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 1993616..5a466fe 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MLJParticleSwarmOptimization" uuid = "17a086e9-ed03-4f30-ab88-8b63f0f6126c" authors = ["Long Nguyen and contributors"] -version = "0.1.2" +version = "0.1.3" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" From a52e944578b45c2d827997ec1e45da96581018f8 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 28 Nov 2022 16:30:36 +1300 Subject: [PATCH 5/7] abandon old parameter access test in favour of weaker but robust tests --- test/parameters.jl | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/parameters.jl b/test/parameters.jl index bb45c24..2b2cb43 100644 --- a/test/parameters.jl +++ b/test/parameters.jl @@ -87,20 +87,19 @@ @test state.X ≈ hcat(Xs...) end - # Distributions 0.25.60 broke the tests marked broken below. Comment from @ablaom: I'd - # say tests that dependend on implementation details of Distributions are not good - # tests, and these should be replaced by more robust tests in the future. I'm guessing - # these are really just integration tests. TODO: fix these tests @testset "Retrieve parameters" begin rng = StableRNG(1234) ranges = [r1, (r2, Uniform), (r3, d3), r4] state = PSO.initialize(rng, ranges, n) PSO.retrieve!(rng, state) params = state.parameters - @test_broken params[1] == ["a", "a", "c"] - @test params[2] ≈ [553, 250, 375] - @test_broken @test params[3] ≈ - [3.9372495283243105, 3.6569395920512977, 3.6354556967115146] - @test_broken params[4] ≈ [-0.8067647f0, 0.4209916f0, 0.6736019f0] + @test params[1] isa AbstractVector{<:AbstractString} + @test params[2] isa AbstractVector{<:Integer} + @test params[3] isa AbstractVector{<:AbstractFloat} + @test params[4] isa AbstractVector{<:AbstractFloat} + @test length(params[4]) == 3 + @test all(params) do p + length(p) == n + end end end From e0ca964b732bf42b40ce9ad970ed70283ad2308e Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 28 Nov 2022 16:31:03 +1300 Subject: [PATCH 6/7] mark a tests apparently broken by Distributions as broken --- test/update.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/update.jl b/test/update.jl index 64d8b24..5207b37 100644 --- a/test/update.jl +++ b/test/update.jl @@ -43,7 +43,8 @@ @testset "Update personal best" begin @test state.pbest == measurements - @test state.pbest_X ≈ [0.35710007620140427 0.37056803307520936 0.2723318907233864 2.7429797605672808 3.9372495283243105 -0.8067647083847199; + # https://github.com/JuliaAI/MLJParticleSwarmOptimization.jl/issues/27 + @test_broken state.pbest_X ≈ [0.35710007620140427 0.37056803307520936 0.2723318907233864 2.7429797605672808 3.9372495283243105 -0.8067647083847199; 0.471258004384426 0.3400938657534834 0.18864812986209056 2.3976392099947 3.6569395920512977 0.420991611378423 ; 0.09661447846912713 0.19630556211862715 0.7070799594122457 2.5742724788985445 3.6354556967115146 0.6736019046580138] end @@ -52,4 +53,5 @@ @test all(state.gbest .== 0.1) @test all(state.gbest_X .== state.pbest_X[2, :]') end -end \ No newline at end of file +end + From 64ba9ce13fab11e5e8ddd7b8443c758c3bc2fd5d Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 28 Nov 2022 16:47:18 +1300 Subject: [PATCH 7/7] bump julia compat to 1.6 --- .github/workflows/CI.yml | 2 +- Project.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d71588d..b5ac991 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: version: - - '1.4' + - '1.6' - '1' os: - ubuntu-latest diff --git a/Project.toml b/Project.toml index 5a466fe..7a64176 100644 --- a/Project.toml +++ b/Project.toml @@ -14,4 +14,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Distributions = "0.25" MLJBase = "0.18, 0.19, 0.20, 0.21" MLJTuning = "0.6, 0.7" -julia = "1.4" +julia = "1.6"