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

[ bsd3, data, data-structures, library, math ] [ Propose Tags ]
This version is deprecated.

Please see the README on GitHub at https://github.com/folivetti/srtree#readme


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.1.2.1, 1.0.0.0, 1.0.0.1, 1.0.0.2, 1.0.0.3, 1.0.0.4, 1.0.0.5 (info)
Change log ChangeLog.md
Dependencies base (>=4.16 && <4.17), containers (>=0.6 && <0.7), mtl (>=2.2 && <2.3), random (>=1.2 && <1.3), vector (>=0.12 && <0.13) [details]
License BSD-3-Clause
Copyright 2023 Fabricio Olivetti de França
Author Fabricio Olivetti de França
Maintainer fabricio.olivetti@gmail.com
Revised Revision 1 made by olivetti at 2023-01-12T16:54:51Z
Category Math, Data, Data Structures
Home page https://github.com/folivetti/srtree#readme
Bug tracker https://github.com/folivetti/srtree/issues
Source repo head: git clone https://github.com/folivetti/srtree
Uploaded by olivetti at 2023-01-12T14:46:13Z
Distributions LTSHaskell:1.0.0.5, NixOS:1.0.0.5, Stackage:1.0.0.5
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 445 total (25 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2023-01-12 [all 2 reports]

Readme for srtree-0.1.0.0

[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 parameterized by the type of the variables indexing and the return value when evaluating the tree. The most common is to index the variables with Int starting at \(0\) and to return a Double. The Functor instance changes the type of the stored/returned values.

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.

This library also defines the OptInt class with the operator ^. that represents the integral power. This is needed to automatically simplify some constructs of the tree and also when using interval arithmetic, that requires a special case of integral power.

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) :: SRTree Int Double

There is also a Bifunctor instance that allows to change the type of both parameters, and an Applicative, Foldable, Traversable instances. To traverse by the index type, there is a function called traverseIx.

Other features:

  • simplification algorithm (simplify)
  • derivative w.r.t. a variable (deriveBy)
  • evaluation (evalTree)
  • relabel free parameters sequentially (relabelParams)
  • relabel variables couting their occurrence (relabelOccurrences, used with interval arithmetic)

TODO:

  • derivative w.r.t. free parameters
  • support more advanced functions
  • support conditional branching (IF-THEN-ELSE)