## SymbolicRegression.jl

Distributed High-Performance symbolic regression in Julia
Author MilesCranmer
Popularity
102 Stars
Updated Last
1 Year Ago
Started In
January 2021

# SymbolicRegression.jl

Distributed High-Performance symbolic regression in Julia.

Check out PySR for a Python frontend.

Cite this software

# Quickstart

Install in Julia with:

```using Pkg

The heart of this package is the `EquationSearch` function, which takes a 2D array (shape [features, rows]) and attempts to model a 1D array (shape [rows]) using analytic functional forms.

Run distributed on four processes with:

```using SymbolicRegression

X = randn(Float32, 5, 100)
y = 2 * cos.(X[4, :]) + X[1, :] .^ 2 .- 2

options = SymbolicRegression.Options(
binary_operators=(+, *, /, -),
unary_operators=(cos, exp),
npopulations=20
)

hallOfFame = EquationSearch(X, y, niterations=5, options=options, numprocs=4)```

We can view the equations in the dominating Pareto frontier with:

`dominating = calculateParetoFrontier(X, y, hallOfFame, options)`

We can convert the best equation to SymbolicUtils.jl with the following function:

```eqn = node_to_symbolic(dominating[end].tree, options)
println(simplify(eqn*5 + 3))```

We can also print out the full pareto frontier like so:

```println("Complexity\tMSE\tEquation")

for member in dominating
size = countNodes(member.tree)
score = member.score
string = stringTree(member.tree, options)

println("\$(size)\t\$(score)\t\$(string)")
end```

## Search options

### Required Packages

View all packages

### Used By Packages

No packages found.