| Copyright | (c) Fabricio Olivetti de Franca 2020 |
|---|---|
| License | GPL-3 |
| Maintainer | fabricio.olivetti@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
IT
Contents
Description
An IT expression represents a function of the form:
\[ f(x) = \sum_{i}{w_i \cdot t_i(\prod_{j}{x_j^{k_{ij}})}} \]
with \(t_i\) being a transformation function.
Any given expression can be represented by a list of terms, with each term
being composed of a transformatioon function and an interaction.
The transformation function is represented by a Transformation sum type.
The interaction is represented as an `IntMap Int` where the key is the
predictor index and the value is the strength of the predictor in this
term. Strengths with a value of zero are omitted.
Synopsis
- type Interaction = IntMap Int
- data Transformation
- data Term = Term Transformation Interaction
- type Expr = [Term]
- type Column a = Vector a
- type Dataset a = Vector (Column a)
- prettyPrint :: ((Int, Int) -> String) -> (Transformation -> String) -> Expr -> [Double] -> String
- toExprStr :: Expr -> [Double] -> String
- toPython :: Expr -> [Double] -> String
- removeIthTerm :: Int -> Expr -> Expr
- getIthTerm :: Int -> Expr -> Maybe Term
- getInteractions :: Term -> Interaction
- exprLength :: Expr -> [Double] -> Int
- termLength :: Term -> Int
- interactionLength :: Interaction -> Int
Documentation
type Interaction = IntMap Int Source #
The Interaction type is a map where
a key, value pair (i,p) indicates that the i-th
variable should be raised to the power of p.
data Transformation Source #
The Transformation type describes the function that
should be evaluated. The evaluation is defined in Eval module.
Instances
| Eq Transformation Source # | |
Defined in IT Methods (==) :: Transformation -> Transformation -> Bool (/=) :: Transformation -> Transformation -> Bool | |
| Ord Transformation Source # | |
Defined in IT Methods compare :: Transformation -> Transformation -> Ordering (<) :: Transformation -> Transformation -> Bool (<=) :: Transformation -> Transformation -> Bool (>) :: Transformation -> Transformation -> Bool (>=) :: Transformation -> Transformation -> Bool max :: Transformation -> Transformation -> Transformation min :: Transformation -> Transformation -> Transformation | |
| Read Transformation Source # | |
Defined in IT Methods readsPrec :: Int -> ReadS Transformation readList :: ReadS [Transformation] readPrec :: ReadPrec Transformation readListPrec :: ReadPrec [Transformation] | |
| Show Transformation Source # | |
Defined in IT Methods showsPrec :: Int -> Transformation -> ShowS show :: Transformation -> String showList :: [Transformation] -> ShowS | |
A Term is the product type of a Transformation and an Interaction.
Constructors
| Term Transformation Interaction |
type Column a = Vector a Source #
A Column of a data set is stored as a LA.Vector to avoid conversions
during the fitting of the coefficients.
Arguments
| :: ((Int, Int) -> String) | A function that converts an interaction to a string |
| -> (Transformation -> String) | A function that converts a transformation to a string |
| -> Expr | The expression to convert to string |
| -> [Double] | The fitted coefficients |
| -> String | A string representing the expression |
Base interface for converting an expression to string
Internal functions
removeIthTerm :: Int -> Expr -> Expr Source #
remove the i-th term of an expression.
getIthTerm :: Int -> Expr -> Maybe Term Source #
returns the i-th term of an expression.
getInteractions :: Term -> Interaction Source #
return the interactions of a term
exprLength :: Expr -> [Double] -> Int Source #
returns the length of an expression as in https://github.com/EpistasisLab/regression-benchmark/blob/dev/CONTRIBUTING.md
termLength :: Term -> Int Source #
The length of a term is the interaction length plus 1 if the
transformation function is not Id.
interactionLength :: Interaction -> Int Source #
The interaction length is calculated as: +2 for every exponent different from 0 and 1 (^k) +1 for every nonzero exponent, except for the first (*) +1 for every nonzero exponent (x_i)