DataDrivenSR

DataDrivenSR provides an API to SymbolicRegression.jl to infer arbitrary systems of equations.

\[y_{i} = f(x_{i}, p, t_i, u_{i})\]

For examples see the tutorial section.

Algorithms

DataDrivenSR.EQSearchType
struct EQSearch <: DataDrivenDiffEq.AbstractDataDrivenAlgorithm

Options for using SymbolicRegression.jl within the solve function. Automatically creates Options with the given specification. Sorts the operators stored in functions into unary and binary operators on conversion.

Keywords

  • weights: optional observation weights with the shape of the target data.
  • numprocs: number of worker processes created for multiprocessing.
  • procs: already allocated worker process IDs.
  • addprocs_function: replacement for Distributed.addprocs when workers are allocated by a scheduler.
  • parallelism: :serial, :multithreading, or :multiprocessing.
  • runtests::Bool: whether SymbolicRegression runs its environment checks first.
  • eq_options: [SymbolicRegression.Options] used by equation search.

Returns

Return an algorithm object usable with the common solve interface. The solver returns a DataDrivenSolution containing the selected symbolic basis.

Fields

  • weights: Optionally weight the loss for each y by this value (same shape as y) Default: nothing

  • numprocs: The number of processes to use, if you want equation_search to set this up automatically. Default: nothing

  • procs: If you have set up a distributed run manually with procs = addprocs() and @everywhere, pass the procs to this keyword argument. Default: nothing

  • addprocs_function: If using multiprocessing (parallelism=:multithreading), and are not passing procs manually, then they will be allocated dynamically using addprocs. However, you may also pass a custom function to use instead of addprocs. This function should take a single positional argument, which is the number of processes to use, as well as the lazy keyword argument. For example, if set up on a slurm cluster, you could pass addprocsfunction = addprocsslurm, which will set up slurm processes. Default: nothing

  • parallelism: What parallelism mode to use. The options are :multithreading, :multiprocessing, and :serial. Multithreading uses less memory, but multiprocessing can handle multi-node compute. If using :multithreading mode, the number of threads available to Julia are used. If using :multiprocessing, numprocs processes will be created dynamically if procs is unset. If you have already allocated processes, pass them to the procs argument, and they will be used. You may also pass a string instead of a symbol. Default: :serial

  • runtests: 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 Default: true

  • eq_options: Options for equation_search Default: SymbolicRegression.Options(operators = SymbolicRegression.OperatorEnum(1 => (), 2 => ()))

Examples

using DataDrivenSR
using SymbolicRegression: OperatorEnum, Options

algorithm = EQSearch(
    eq_options = Options(operators = OperatorEnum(1 => (sin,), 2 => (+, *)))
)
source

Reexported API

using DataDrivenSR also brings two SymbolicRegression names into scope, so that an EQSearch can be configured without importing SymbolicRegression separately:

  • SymbolicRegression — the module itself, for qualified access. This is how the examples on this site build their options: SymbolicRegression.Options(binary_operators = [+, *], ...).
  • Options — SymbolicRegression's option type, the value of the eq_options field of EQSearch.

DataDrivenSR does not own or document either name. Both are owned and documented by SymbolicRegression.jl; see its API reference for what Options accepts.

Nothing else from SymbolicRegression is reexported. equation_search, Node, Population, the operator and template machinery, and the LossFunctions types (L1DistLoss and friends) reexported by SymbolicRegression must be imported from SymbolicRegression or LossFunctions directly.