srtree-2.0.0.0: A general library to work with Symbolic Regression expression trees.
Copyright(c) Fabricio Olivetti 2021 - 2024
LicenseBSD3
Maintainerfabricio.olivetti@gmail.com
Stabilityexperimental
PortabilityConstraintKinds
Safe HaskellSafe-Inferred
LanguageHaskell2010

Algorithm.SRTree.Likelihoods

Description

Functions to calculate different likelihood functions, their gradient, and Hessian matrices.

Synopsis

Documentation

type PVector = Array S Ix1 Double #

Vector of parameter values. Needs to be strict to be readily accesible.

type SRMatrix = Array S Ix2 Double #

Matrix of features values

sse :: SRMatrix -> PVector -> Fix SRTree -> PVector -> Double #

Sum-of-square errors or Sum-of-square residues

mse :: SRMatrix -> PVector -> Fix SRTree -> PVector -> Double #

Mean squared errors

rmse :: SRMatrix -> PVector -> Fix SRTree -> PVector -> Double #

Root of the mean squared errors

nll :: Distribution -> Maybe Double -> SRMatrix -> PVector -> Fix SRTree -> PVector -> Double #

Gaussian distribution

Negative log-likelihood

predict :: Distribution -> Fix SRTree -> PVector -> SRMatrix -> SRVector #

Prediction for different distributions

gradNLL :: Distribution -> Maybe Double -> SRMatrix -> PVector -> Fix SRTree -> PVector -> (Double, SRVector) #

Gradient of the negative log-likelihood

gradNLLNonUnique :: Distribution -> Maybe Double -> SRMatrix -> PVector -> Fix SRTree -> PVector -> (Double, SRVector) #

Gradient of the negative log-likelihood

fisherNLL :: Distribution -> Maybe Double -> SRMatrix -> PVector -> Fix SRTree -> PVector -> SRVector #

Fisher information of negative log-likelihood

getSErr :: Num a => Distribution -> a -> Maybe a -> a #

get the standard error from a Maybe Double if it is Nothing, estimate from the ssr, otherwise use the current value For distributions other than Gaussian, it defaults to a constant 1

hessianNLL :: Distribution -> Maybe Double -> SRMatrix -> PVector -> Fix SRTree -> PVector -> SRMatrix #

Hessian of negative log-likelihood

Note, though the Fisher is just the diagonal of the return of this function it is better to keep them as different functions for efficiency