Skip to content

Commit

Permalink
fix: turn off progress bars in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 20, 2024
1 parent 2545c2f commit 1100ab4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/DataDrivenLux/src/algorithms/reinforce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $(SIGNATURES)
Uses the REINFORCE algorithm to search over the space of possible solutions to the
symbolic regression problem.
"""
function Reinforce(reward = RelativeReward(false); populationsize = 100,
function Reinforce(; reward = RelativeReward(false), populationsize = 100,
functions = (sin, exp, cos, log, +, -, /, *), arities = (1, 1, 1, 1, 2, 2, 2, 2),
n_layers = 1, skip = true, loss = aicc, keep = 0.1, use_protected = true,
distributed = false, threaded = false, rng = Random.default_rng(),
Expand Down
2 changes: 1 addition & 1 deletion lib/DataDrivenLux/test/candidate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ end
Y = sin.(2.0 * X)
@variables x
@parameters p [bounds = (1.0, 2.5), dist = Normal(1.75, 1.0)]
basis = Basis([sin(p * x)], [x], parameters = [p])
basis = Basis([sin(p * x)], [x], parameters = [p]) # NaNMath.sin causes issues

dataset = Dataset(X, Y)
rng = StableRNG(2)
Expand Down
3 changes: 2 additions & 1 deletion lib/DataDrivenLux/test/crossentropy_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ alg = CrossEntropy(populationsize = 2_00, functions = (sin, exp, +), arities = (
threaded = true, optim_options = Optim.Options(time_limit = 0.2))

res = solve(dummy_problem, b, alg,
options = DataDrivenCommonOptions(maxiters = 1_000, progress = true, abstol = 0.0))
options = DataDrivenCommonOptions(
maxiters = 1_000, progress = parse(Bool, get(ENV, "CI", "false")), abstol = 0.0))
@test rss(res) <= 1e-2
@test aicc(res) <= -100.0
@test r2(res) >= 0.95
Expand Down
8 changes: 5 additions & 3 deletions lib/DataDrivenLux/test/randomsearch_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ for (data, _interval) in zip((X, Y, 1:size(X, 2)),
end

# We have 1 Choices in the first layer, 2 in the last
alg = RandomSearch(populationsize = 10, functions = (sin, exp, *),
arities = (1, 1, 2), rng = rng, n_layers = 2, loss = rss, keep = 2)
alg = RandomSearch(;
populationsize = 10, functions = (sin, exp, *), arities = (1, 1, 2), rng,
n_layers = 2, loss = rss, keep = 2)

res = solve(dummy_problem, alg,
options = DataDrivenCommonOptions(maxiters = 50, progress = true, abstol = 0.0))
options = DataDrivenCommonOptions(
maxiters = 50, progress = parse(Bool, get(ENV, "CI", "false")), abstol = 0.0))
@test rss(res) <= 1e-2
@test aicc(res) <= -100.0
@test r2(res) >= 0.95
Expand Down
7 changes: 4 additions & 3 deletions lib/DataDrivenLux/test/reinforce_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ dummy_dataset = DataDrivenLux.Dataset(dummy_problem)

b = Basis([x; exp.(x)], x)
# We have 1 Choices in the first layer, 2 in the last
alg = Reinforce(
populationsize = 200, functions = (sin, exp, +), arities = (1, 1, 2), rng = rng,
alg = Reinforce(;
populationsize = 200, functions = (sin, exp, +), arities = (1, 1, 2), rng,
n_layers = 3, use_protected = true, loss = bic, keep = 10, threaded = true,
optim_options = Optim.Options(time_limit = 0.2), optimiser = AdamW(1e-2))

res = solve(dummy_problem, b, alg,
options = DataDrivenCommonOptions(maxiters = 1000, progress = true, abstol = 0.0))
options = DataDrivenCommonOptions(
maxiters = 1000, progress = parse(Bool, get(ENV, "CI", "false")), abstol = 0.0))

@test rss(res) <= 1e-2
@test aicc(res) <= -100.0
Expand Down

0 comments on commit 1100ab4

Please sign in to comment.