Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling
uses: crate-ci/[email protected]
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[default.extend-words]
11 changes: 8 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Expand All @@ -24,29 +23,35 @@ SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
Aqua = "0.8"
CommonSolve = "0.2"
DataInterpolations = "4"
DiffEqBase = "6"
DocStringExtensions = "0.7, 0.8, 0.9"
LinearAlgebra = "1"
MLUtils = "0.3, 0.4"
ModelingToolkit = "7, 8"
Parameters = "0.12"
ProgressMeter = "1.6"
Pkg = "1"
QuadGK = "2.4"
Random = "1"
RecipesBase = "1"
Reexport = "1.0"
Setfield = "1"
SafeTestsets = "0.1"
Statistics = "1"
StatsBase = "0.32.0, 0.33, 0.34"
SymbolicUtils = "1"
Symbolics = "5"
Test = "1"
julia = "1.6"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Random", "SafeTestsets", "Pkg"]
test = ["Aqua", "Test", "Random", "SafeTestsets", "Pkg"]
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
[compat]
DataDrivenDiffEq = "1"
Documenter = "1"
LinearAlgebra = "1"
Literate = "2.14"
ModelingToolkit = "8"
OrdinaryDiffEq = "6"
Plots = "1"
Random = "1"
StableRNGs = "1"
StatsBase = "0.33, 0.34"
2 changes: 1 addition & 1 deletion docs/src/libs/datadrivendmd/example_02.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sys = ODEProblem(f, u0, tspan)
sol = solve(sys, Tsit5(), saveat = 0.05);

# We could use the `DESolution` to define our problem, but here we want to use the data for didactic purposes.
# For a [`ContinuousDataDrivenProblem`](@ref DataDrivenProblem), we need either the state trajectory and the timepoints or the state trajectory and its derivate.
# For a [`ContinuousDataDrivenProblem`](@ref DataDrivenProblem), we need either the state trajectory and the timepoints or the state trajectory and its derivative.

X = Array(sol)
t = sol.t
Expand Down
2 changes: 1 addition & 1 deletion docs/src/libs/datadrivendmd/example_04.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# # [Nonlinear Time Continuous System](@id nonlinear_continuos)
# # [Nonlinear Time Continuous System](@id nonlinear_continuous)
#
# Similarly, we can use the [Extended Dynamic Mode Decomposition](https://link.springer.com/article/10.1007/s00332-015-9258-5) via a nonlinear [`Basis`](@ref) of observables. Here, we will look at a rather [famous example](https://arxiv.org/pdf/1510.03007.pdf) with a finite dimensional solution.

Expand Down
2 changes: 1 addition & 1 deletion lib/DataDrivenDMD/src/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Return the approximation of the discrete Koopman operator stored in `k`.
"""
operator(k::Koopman{<:Any, <:Any, <:Any, true}) = __get_K(k)
function operator(k::Koopman{<:Any, <:Any, <:Any, false})
throw(AssertionError("Koopman is continouos."))
throw(AssertionError("Koopman is continuous."))
end

"""_
Expand Down
2 changes: 1 addition & 1 deletion lib/DataDrivenLux/src/algorithms/rewards.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end
"""
$(TYPEDEF)

Scales the losses in such a way that the minimum loss is the most influencial reward.
Scales the losses in such a way that the minimum loss is the most influential reward.
"""
struct AbsoluteReward{risk} <: AbstractRewardScale{risk} end

Expand Down
4 changes: 2 additions & 2 deletions lib/DataDrivenLux/src/caches/candidate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ get_nodes(c::Candidate) = ChainRulesCore.@ignore_derivatives get_nodes(c.outgoin
function convert_to_basis(candidate::Candidate, ps = candidate.ps,
options = DataDrivenCommonOptions())
@unpack basis, model = candidate.model
@unpack eval_expresssion = options
@unpack eval_expression = options
p_best = get_parameters(candidate)

p_new = map(enumerate(ModelingToolkit.parameters(basis))) do (i, ps)
Expand All @@ -243,5 +243,5 @@ function convert_to_basis(candidate::Candidate, ps = candidate.ps,
controls = controls(basis), observed = observed(basis),
implicits = implicit_variables(basis),
name = gensym(:Basis),
eval_expression = eval_expresssion)
eval_expression = eval_expression)
end
2 changes: 1 addition & 1 deletion lib/DataDrivenLux/src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function CommonSolve.solve!(prob::InternalDataDrivenProblem{A}) where {
AbstractDAGSRAlgorithm
}
@unpack alg, basis, testdata, traindata, control_idx, options, problem, kwargs = prob
@unpack maxiters, progress, eval_expresssion, abstol = options
@unpack maxiters, progress, eval_expression, abstol = options

cache = init_cache(alg, basis, problem)
p = ProgressMeter.Progress(maxiters, dt = 0.1, enabled = progress)
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 @@ -30,7 +30,7 @@ using StableRNGs
options = Optim.Options())
end

@testset "Candidate with parametes" begin
@testset "Candidate with parameters" begin
fs = (exp,)
arities = (1,)
dag = LayeredDAG(1, 1, 1, arities, fs, skip = true)
Expand Down
6 changes: 3 additions & 3 deletions lib/DataDrivenSR/src/DataDrivenSR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ end
function convert_to_basis(paretofrontier, prob)
@unpack alg, basis, problem, options = prob
@unpack eq_options = alg
@unpack maxiters, eval_expresssion, generate_symbolic_parameters, digits, roundingmode = options
@unpack maxiters, eval_expression, generate_symbolic_parameters, digits, roundingmode = options

eqs_ = map(paretofrontier) do dom
node_to_symbolic(dom[end].tree, eq_options)
Expand Down Expand Up @@ -175,7 +175,7 @@ function convert_to_basis(paretofrontier, prob)
controls = controls(basis), observed = observed(basis),
implicits = implicit_variables(basis),
name = gensym(:Basis),
eval_expression = eval_expresssion)
eval_expression = eval_expression)
end

# apply the algorithm on each dataset
Expand Down Expand Up @@ -207,7 +207,7 @@ function CommonSolve.solve!(ps::InternalDataDrivenProblem{EQSearch})
@unpack alg, basis, testdata, traindata, kwargs = ps
@unpack weights, numprocs, procs, addprocs_function, parallelism, runtests, eq_options = alg
@unpack traindata, testdata, basis, options = ps
@unpack maxiters, eval_expresssion, generate_symbolic_parameters, digits, roundingmode, selector = options
@unpack maxiters, eval_expression, generate_symbolic_parameters, digits, roundingmode, selector = options
@unpack problem = ps

results = map(traindata) do (X, Y)
Expand Down
2 changes: 1 addition & 1 deletion lib/DataDrivenSparse/src/commonsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function __sparse_regression(ps::InternalDataDrivenProblem{<:ImplicitOptimizer},
opt_iterations = []

foreach(enumerate(eachcol(candidate_matrix))) do (i, idx)
# We enforce that one of the implicit variables is necessary for sucess
# We enforce that one of the implicit variables is necessary for success
coeff, thresholds, iters = alg(X[idx, :], Y, options = options,
necessary_idx = implicit_idx[idx, i])
opt_coefficients[i:i, idx] .= coeff
Expand Down
2 changes: 1 addition & 1 deletion src/DataDrivenDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using RecipesBase
@enum DDProbType begin
Direct = 1 # Direct problem without further information
Discrete = 2 # Time discrete problem
Continuous = 3 # Time continous problem
Continuous = 3 # Time continuous problem
end

# We want to export the ReturnCodes
Expand Down
4 changes: 2 additions & 2 deletions src/basis/build_function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function (f::DataDrivenFunction{false, true})(u::AbstractVector, p::P, t::Number
_apply_function(f, __EMPTY_VECTOR, u, p, t, c)
end

# With implict, without controls
# With implicit, without controls
function (f::DataDrivenFunction{true, false})(du::AbstractVector, u::AbstractVector, p::P,
t::Number) where {
P <:
Expand Down Expand Up @@ -100,7 +100,7 @@ function (f::DataDrivenFunction{false, true})(res::AbstractVector, u::AbstractVe
_apply_function!(f, res, __EMPTY_VECTOR, u, p, t, c)
end

# With implict, without controls
# With implicit, without controls
function (f::DataDrivenFunction{true, false})(res::AbstractVector, du::AbstractVector,
u::AbstractVector, p::P,
t::Number) where {
Expand Down
2 changes: 1 addition & 1 deletion src/basis/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function (b::Basis{false, true})(u::AbstractVector,
f(u, p, t, c)
end

# With implict, without controls
# With implicit, without controls
function (b::Basis{true, false})(du::AbstractVector, u::AbstractVector,
p::P = parameters(b),
t::Number = get_iv(b)) where {
Expand Down
2 changes: 1 addition & 1 deletion src/commonsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ function CommonSolve.init(prob::AbstractDataDrivenProblem, basis::AbstractBasis,
end

function CommonSolve.solve!(::InternalDataDrivenProblem{ZeroDataDrivenAlgorithm})
@warn "No sufficient algorithm choosen! Return ErrorDataDrivenResult!"
@warn "No sufficient algorithm chosen! Return ErrorDataDrivenResult!"
return ErrorDataDrivenResult()
end
6 changes: 3 additions & 3 deletions src/problem/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Three construction methods are available:

+ `DirectDataDrivenProblem` for direct mappings
+ `DiscreteDataDrivenProblem` for time discrete systems
+ `ContinousDataDrivenProblem` for systems continuous in time
+ `ContinuousDataDrivenProblem` for systems continuous in time

where all are aliases for constructing a problem.

Expand Down Expand Up @@ -123,7 +123,7 @@ function DataDrivenProblem(probType, X, t, DX, Y, U, p; name = gensym(:DDProblem
if (isempty(DX) && !isempty(Y))
probType = DDProbType(1) # Direct problem
elseif !isempty(DX)
probType = DDProbType(3) # Continouos
probType = DDProbType(3) # Continuous
end
end

Expand Down Expand Up @@ -206,7 +206,7 @@ function DiscreteDataDrivenProblem(X::AbstractMatrix, t::AbstractVector, U::Func
return DataDrivenProblem(X; t = t, U = U, probtype = DDProbType(2), kwargs...)
end

## Continouos Constructors
## Continuous Constructors
"""
A time continuous `DataDrivenProblem` useable for problems of the form `f(x,p,t,u) ↦ dx/dt`.

Expand Down
4 changes: 2 additions & 2 deletions src/utils/build_basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function _implicit_build_eqs(basis, eqs, p, prob)
end

function __construct_basis(X, b, prob, options)
@unpack eval_expresssion, generate_symbolic_parameters, digits, roundingmode = options
@unpack eval_expression, generate_symbolic_parameters, digits, roundingmode = options

p = parameters(prob)

Expand Down Expand Up @@ -162,7 +162,7 @@ function __construct_basis(X, b, prob, options)
controls = controls(b), observed = observed(b),
implicits = implicits,
name = gensym(:Basis),
eval_expression = eval_expresssion)
eval_expression = eval_expression)
end

function unit_basis(prob::DataDrivenProblem)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/common_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Denoising happens before normalization!
"""Enables the use of symbolic parameters for the result. If `false`, the numerical value is used."""
generate_symbolic_parameters::Bool = true
"""Evaluate the expression, see [`Symbolics.build_function`](https://symbolics.juliasymbolics.org/stable/manual/build_function/)"""
eval_expresssion::Bool = false
eval_expression::Bool = false
"""Additional kwargs"""
kwargs::K = (;)
end
11 changes: 11 additions & 0 deletions test/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using DataDrivenDiffEq, Aqua
@testset "Aqua" begin
Aqua.find_persistent_tasks_deps(DataDrivenDiffEq)
Aqua.test_ambiguities(DataDrivenDiffEq, recursive = false, broken = true)
Aqua.test_deps_compat(DataDrivenDiffEq)
Aqua.test_piracies(DataDrivenDiffEq, broken = true)
Aqua.test_project_extras(DataDrivenDiffEq)
Aqua.test_stale_deps(DataDrivenDiffEq)
Aqua.test_unbound_args(DataDrivenDiffEq, broken = true)
Aqua.test_undefined_exports(DataDrivenDiffEq, broken = true)
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function activate_subpkg_env(subpkg)
end

@time begin if GROUP == "All" || GROUP == "Core" || GROUP == "Downstream"
@safetestset "Quality Assurance" begin include("qa.jl") end
@safetestset "Basis" begin include("./basis/basis.jl") end
@safetestset "Implicit Basis" begin include("./basis/implicit_basis.jl") end
@safetestset "Basis generators" begin include("./basis/generators.jl") end
Expand Down