Skip to content

Commit 1866992

Browse files
Merge pull request #533 from lcontento/lc/sr1
Fix CI
2 parents 8f87f7a + 5557c7f commit 1866992

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

lib/DataDrivenSR/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SymbolicRegression = "8254be44-1295-4e6a-a16d-46603ac705cb"
1111
[compat]
1212
Reexport = "1.2"
1313
DataDrivenDiffEq = "1"
14-
SymbolicRegression = "0.17"
14+
SymbolicRegression = "1"
1515
julia = "1.6"
1616

1717
[extras]

lib/DataDrivenSR/src/DataDrivenSR.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ using Reexport
2222
"""
2323
$(TYPEDEF)
2424
Options for using SymbolicRegression.jl within the `solve` function.
25-
Automatically creates [`Options`](https://astroautomata.com/SymbolicRegression.jl/stable/api/#Options) with the given specification.
25+
Automatically creates [`Options`](https://ai.damtp.cam.ac.uk/symbolicregression/stable/api/#Options) with the given specification.
2626
Sorts the operators stored in `functions` into unary and binary operators on conversion.
2727
# Fields
2828
$(FIELDS)
2929
"""
3030
@with_kw struct EQSearch <: AbstractDataDrivenAlgorithm
3131
"Optionally weight the loss for each y by this value (same shape as y)"
3232
weights::Union{AbstractMatrix, AbstractVector, Nothing} = nothing
33-
"The number of processes to use, if you want EquationSearch to set this up automatically."
33+
"The number of processes to use, if you want `equation_search` to set this up automatically."
3434
numprocs = nothing
3535
"If you have set up a distributed run manually with procs = addprocs() and @everywhere, pass the procs to this keyword argument."
3636
procs::Union{Vector{Int}, Nothing} = nothing
@@ -40,7 +40,7 @@ $(FIELDS)
4040
parallelism::Union{String, Symbol} = :serial
4141
"Whether to run (quick) tests before starting the search, to see if there will be any problems during the equation search related to the host environment"
4242
runtests::Bool = true
43-
"Options for 'EquationSearch'"
43+
"Options for `equation_search`"
4444
eq_options::SymbolicRegression.Options = SymbolicRegression.Options()
4545
end
4646

@@ -184,7 +184,7 @@ function (x::EQSearch)(ps::InternalDataDrivenProblem{EQSearch}, X, Y)
184184
@unpack maxiters, abstol = options
185185
@unpack weights, eq_options, numprocs, procs, parallelism, runtests = x
186186

187-
hofs = SymbolicRegression.EquationSearch(X, Y,
187+
hofs = SymbolicRegression.equation_search(X, Y;
188188
niterations = maxiters,
189189
weights = weights,
190190
options = eq_options,
@@ -197,7 +197,7 @@ function (x::EQSearch)(ps::InternalDataDrivenProblem{EQSearch}, X, Y)
197197

198198
# Evaluate over the full training data
199199
paretos = map(enumerate(hofs)) do (i, hof)
200-
SymbolicRegression.calculate_pareto_frontier(X, Y[i, :], hof, eq_options)
200+
SymbolicRegression.calculate_pareto_frontier(hof)
201201
end
202202

203203
return SRResult(ps, hofs, paretos)

lib/DataDrivenSR/test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ X = rand(rng, 2, 50)
99
@testset "Simple" begin
1010
alg = DataDrivenSR.EQSearch(eq_options = Options(unary_operators = [sin, exp],
1111
binary_operators = [*], maxdepth = 1,
12+
seed = 42,
1213
verbosity = -1, progress = false))
1314
f(x) = [sin(x[1]); exp(x[2])]
1415
Y = hcat(map(f, eachcol(X))...)
@@ -21,6 +22,7 @@ end
2122
@testset "Univariate" begin
2223
alg = DataDrivenSR.EQSearch(eq_options = Options(unary_operators = [sin, exp],
2324
binary_operators = [*], maxdepth = 1,
25+
seed = 42,
2426
verbosity = -1, progress = false))
2527

2628
Y = sin.(X[1:1, :])
@@ -33,6 +35,7 @@ end
3335
@testset "Lifted" begin
3436
alg = DataDrivenSR.EQSearch(eq_options = Options(unary_operators = [sin, exp],
3537
binary_operators = [+], maxdepth = 1,
38+
seed = 42,
3639
verbosity = -1, progress = false))
3740

3841
f(x) = [sin(x[1] .^ 2); exp(x[2] * x[1])]

lib/DataDrivenSparse/src/DataDrivenSparse.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ abstract type AbstractProximalOperator end
2525

2626
abstract type AbstractSparseRegressionCache <: StatsBase.StatisticalModel end
2727

28-
function _set!(x::AbstractSparseRegressionCache,
29-
y::AbstractSparseRegressionCache) where {T <: Number}
28+
function _set!(x::AbstractSparseRegressionCache, y::AbstractSparseRegressionCache)
3029
begin
3130
foreach(eachindex(x.X)) do i
3231
x.X[i] = y.X[i]

lib/DataDrivenSparse/test/sparse_linear_solve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ end
6464
cos.(0.5 .* t .^ 2 .- 0.1), exp.(-t))))
6565
Y = permutedims(0.5 * X[1, :] + 0.22 * X[4, :] - 2.0 * X[3, :])
6666
X = vcat(X, Y)
67-
for alg in [STLSQ, ADMM, SR3]
68-
opt = ImplicitOptimizer(alg())
67+
for alg in [STLSQ(0.1, 1.0), ADMM(), SR3()]
68+
opt = ImplicitOptimizer(alg)
6969
rescoeff, _... = opt(X, Y, options = DataDrivenCommonOptions(maxiters = 2000))
7070
@test vec(rescoeff)[0.25; 0.0; -1.0; 0.11; 0.0; -0.5] atol=5e-2
7171
end

src/utils/build_basis.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function _implicit_build_eqs(basis, eqs, p, prob)
102102
eqs = eqs .~ 0
103103
try
104104
# Try to solve the eq for the implicits
105-
eqs = ModelingToolkit.solve_for(eqs, implicits)
105+
eqs = ModelingToolkit.symbolic_linear_solve(eqs, implicits)
106106
eqs = implicits .~ eqs
107107
implicits = Num[]
108108
catch

0 commit comments

Comments
 (0)