Copyright | (c) Fabricio Olivetti de Franca 2020 |
---|---|
License | GPL-3 |
Maintainer | fabricio.olivetti@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
IT.Eval
Description
Definition of functions pertaining to the conversion and evaluation of an IT-expression.
TODO: move interval evaluation to IT.Eval.Interval
Synopsis
- log1p :: Floating a => a -> a
- transform :: Floating a => Transformation -> a -> a
- derivative :: Floating a => Transformation -> a -> a
- sndDerivative :: Floating a => Transformation -> a -> a
- polynomial :: Dataset Double -> Interaction -> Column Double
- polynomialInterval :: [Interval Double] -> Interaction -> Interval Double
- evalTerm :: Dataset Double -> Term -> Column Double
- evalTermInterval :: [Interval Double] -> Term -> Interval Double
- evalTermDiff :: Int -> Dataset Double -> Term -> Column Double
- evalTermSndDiff :: Int -> Int -> Dataset Double -> Term -> Column Double
- evalTermDiffInterval :: Int -> [Interval Double] -> Term -> Interval Double
- evalTermSndDiffInterval :: Int -> Int -> [Interval Double] -> Term -> Interval Double
- evalGeneric :: (Dataset Double -> Term -> Column Double) -> Dataset Double -> Expr -> [Double] -> Column Double
- evalExpr :: Dataset Double -> Expr -> [Double] -> Column Double
- evalDiff :: Int -> Dataset Double -> Expr -> [Double] -> Column Double
- evalSndDiff :: Int -> Int -> Dataset Double -> Expr -> [Double] -> Column Double
- evalImageGeneric :: ([Interval Double] -> Term -> Interval Double) -> [Interval Double] -> Expr -> [Double] -> Interval Double
- evalImage :: [Interval Double] -> Expr -> [Double] -> Interval Double
- evalDiffImage :: Int -> [Interval Double] -> Expr -> [Double] -> Interval Double
- evalSndDiffImage :: Int -> Int -> [Interval Double] -> Expr -> [Double] -> Interval Double
- isInvalid :: Double -> Bool
- isValid :: [Double] -> Bool
- exprToMatrix :: Dataset Double -> Expr -> Matrix Double
- cleanExpr :: Dataset Double -> Expr -> (Expr, Matrix Double)
- notInfNan :: Solution -> Bool
- nanInterval :: RealFloat a => Interval a
- hasInf :: RealFloat a => Interval a -> Bool
- protected :: RealFloat a => (Interval a -> Interval a) -> Interval a -> Interval a
Documentation
Evaluation of the Transformation functions
transform :: Floating a => Transformation -> a -> a Source #
Evaluate the transformation function f
in a data point x
.
derivative :: Floating a => Transformation -> a -> a Source #
Evaluate the derivative of a transformation function.
sndDerivative :: Floating a => Transformation -> a -> a Source #
Evaluate the second derivative of the transformation function.
polynomial :: Dataset Double -> Interaction -> Column Double Source #
Evaluates the interaction ks
in the dataset xss
It folds the map of exponents with the key, retrieve the corresponding column, calculates x_i^k_i and multiplies to the accumulator. It return a column vector.
polynomialInterval :: [Interval Double] -> Interaction -> Interval Double Source #
Evaluates the interval of the interaction w.r.t. the domains of the variables.
In this case it is faster to fold through the list of domains and checking whether we have a nonzero strength.
evalTerm :: Dataset Double -> Term -> Column Double Source #
Evaluates a term by applying the transformation function to the result of the interaction.
evalTermInterval :: [Interval Double] -> Term -> Interval Double Source #
Evaluates the term on the interval domains.
evalTermDiff :: Int -> Dataset Double -> Term -> Column Double Source #
The partial derivative of a term w.r.t. the variable ix is:
If ix exists in the interaction, the derivative is: derivative t (polynomial xss ks) * (polynomial xss ks') ks' is the same as ks but with the strength of ix decremented by one Otherwise it is equal to 0
Given the expression: w1 t1(p1(x)) + w2 t2(p2(x)) The derivative is: w1 t1'(p1(x))p1'(x) + w2 t2'(p2(x))p2'(x)
evalTermSndDiff :: Int -> Int -> Dataset Double -> Term -> Column Double Source #
The second partial derivative of a term w.r.t. the variables ix and iy is:
given p(x) as the interaction function, t(x) the transformation function, f'(x)|i the first derivative of a function given i and f''(x) the second derivative.
If iy exists in p(x) and ix exists in p'(x)|iy, the derivative is:
kx*ky*t''(x)*p'(x)|ix * p'(x)|iy + kxy*t'(x)p''(x)
where kx, ky are the original exponents of variables ix and iy, and kxy is ky * kx', with kx' the exponent of ix on p'(x)|iy
evalTermDiffInterval :: Int -> [Interval Double] -> Term -> Interval Double Source #
Same as evalTermDiff
but optimized for intervals.
evalTermSndDiffInterval :: Int -> Int -> [Interval Double] -> Term -> Interval Double Source #
Same as evalTermSndDiff
but optimized for intervals
evalGeneric :: (Dataset Double -> Term -> Column Double) -> Dataset Double -> Expr -> [Double] -> Column Double Source #
evaluates an expression by evaluating the terms into a list applying the weight and summing the results.
evalExpr :: Dataset Double -> Expr -> [Double] -> Column Double Source #
Evaluating an expression is simply applying evalTerm
evalDiff :: Int -> Dataset Double -> Expr -> [Double] -> Column Double Source #
Evaluating the derivative is applying evalTermDiff
in the expression
evalSndDiff :: Int -> Int -> Dataset Double -> Expr -> [Double] -> Column Double Source #
Evaluating the second derivative is applying evalTermSndDiff
in the expression
evalImageGeneric :: ([Interval Double] -> Term -> Interval Double) -> [Interval Double] -> Expr -> [Double] -> Interval Double Source #
Returns the estimate of the image of the funcion with Interval Arithmetic
this requires a different implementation from evalGeneric
evalDiffImage :: Int -> [Interval Double] -> Expr -> [Double] -> Interval Double Source #
evalSndDiffImage :: Int -> Int -> [Interval Double] -> Expr -> [Double] -> Interval Double Source #
isValid :: [Double] -> Bool Source #
a set of points is valid if none of its values are invalid and the maximum abosolute value is below 1e150 (to avoid overflow)
exprToMatrix :: Dataset Double -> Expr -> Matrix Double Source #
evaluate an expression to a set of samples
(1 LA.|||) adds a bias dimension
cleanExpr :: Dataset Double -> Expr -> (Expr, Matrix Double) Source #
Clean the expression by removing the invalid terms TODO: move to IT.Regression
nanInterval :: RealFloat a => Interval a Source #
definition of an interval evaluated to NaN