srtree: A general framework to work with Symbolic Regression expression trees.

[ bsd3, data, data-structures, library, math ] [ Propose Tags ]

A Symbolic Regression Tree data structure to work with mathematical expressions with support to first order derivative and simplification;

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,,,,,,,, (info)
Change log
Dependencies base (>=4.16 && <5), containers (>=0.6 && <0.7), dlist (>=1.0 && <1.1), mtl (>=2.2 && <2.4), random (>=1.2 && <1.3), vector (>=0.12 && <0.14) [details]
License BSD-3-Clause
Copyright 2023 Fabricio Olivetti de França
Author Fabricio Olivetti de França
Category Math, Data, Data Structures
Home page
Bug tracker
Source repo head: git clone
Uploaded by olivetti at 2023-06-25T11:51:56Z
Distributions LTSHaskell:, NixOS:, Stackage:
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 387 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for srtree-

[back to package description]

srtree: A symbolic regression expression tree structure.

srtree is a Haskell library with a data structure and supporting functions to manipulate expression trees for symbolic regression.

The tree-like structure is defined as a fixed-point of an n-ary tree. The variables and parameters of the regression model are indexed as Inttype and the constant values are Double.

The tree supports leaf nodes containing a variable, a free parameter, or a constant value; internal nodes that represents binary operators such as the four basic math operations, logarithm with custom base, and the power of two expressions; and unary functions specified by Function data type.

The SRTree structure has instances for Num, Fractional, Floating which allows to create an expression as a valid Haskell expression such as:

x = var 0)
y = var 1
expr = x * 2 + sin(y * pi + x) :: Fix SRTree

Other features:

  • derivative w.r.t. a variable (deriveByVar) and w.r.t. a parameter (deriveByParam)
  • evaluation (evalTree)
  • relabel free parameters sequentially (relabelParams)
  • gradient calculation with forwardMode, or optimized with gradParams if there is only a single occurrence of each parameter (most of the cases).


  • support more advanced functions
  • support conditional branching (IF-THEN-ELSE)