SymbolicRegression

scalation.modeling.SymbolicRegression

The SymbolicRegression object supports symbolic regression that allows variables/columns to be raised to various powers, e.g., x^2, x^3, x^.5. Note, x~^p is a column-wise power function (each column raised to p-th power). IMPORTANT: must not include intercept (column of ones) in initial data matrix), i.e., DO NOT include a column of ones in x (will cause singularity in expanded matrix).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(x: MatrixD, y: VectorD, fname: Array[String], powers: Set[Double], intercept: Boolean, cross: Boolean, cross3: Boolean, hparam: HyperParameter, terms: Array[Xj2p]*): Regression

Create a Regression object from a data matrix and a response vector. Partial support for "Symbolic Regression" as matrix x can be raised to several powers (e.g., x^1 and x^2).

Create a Regression object from a data matrix and a response vector. Partial support for "Symbolic Regression" as matrix x can be raised to several powers (e.g., x^1 and x^2).

Value parameters

cross

whether to include 2-way cross/interaction terms x_i x_j (defaults to true)

cross3

whether to include 3-way cross/interaction terms x_i x_j x_k (defaults to false)

fname

the feature/variable names (defaults to null)

hparam

the hyper-parameters (use Regression.hp for default)

intercept

whether to include the intercept term (column of ones) _1 (defaults to true)

powers

the set of powers to raise matrix x to (defaults to null)

terms

custom terms to add into the model, e.g., Array ((0, 1.0), (1, -2.0)) adds x0 x1^(-2)

x

the initial data/input m-by-n matrix (before expansion) must not include an intercept column of all ones

y

the response/output m-vector

Attributes

def buildMatrix(x: MatrixD, fname: Array[String], powers: Set[Double], intercept: Boolean, cross: Boolean, cross3: Boolean, terms: Array[Xj2p]*): (MatrixD, Array[String])

Build an expanded input/data matrix from the initial data/input matrix.

Build an expanded input/data matrix from the initial data/input matrix.

Value parameters

cross

whether to include 2-way cross/interaction terms x_i x_j (defaults to true)

cross3

whether to include 3-way cross/interaction terms x_i x_j x_k (defaults to false)

fname

the feature/variable names (should not be null here)

intercept

whether to include the intercept term (column of ones) _1 (defaults to true)

powers

the set of powers to raise matrix x to

terms

custom terms to add into the model, e.g., Array ((0, 1.0), (1, -2.0)) adds x0 x1^(-2)

x

the initial data/input m-by-n matrix (before expansion) must not include an intercept column of all ones

Attributes

def crossNames(nm: Array[String]): Array[String]

Create all cross names for the 2-way interaction/cross terms: e.g., "name1_name2".

Create all cross names for the 2-way interaction/cross terms: e.g., "name1_name2".

Value parameters

nm

the array of names to be crossed

Attributes

def crossNames3(nm: Array[String]): Array[String]

Create all cross names for the 3-way interaction/cross terms: e.g., "name1_name2_name3".

Create all cross names for the 3-way interaction/cross terms: e.g., "name1_name2_name3".

Value parameters

nm

the array of names to be crossed

Attributes

def cubic(x: MatrixD, y: VectorD, fname: Array[String], intercept: Boolean, cross: Boolean, cross3: Boolean, hparam: HyperParameter): Regression

Create a Regression object that uses multiple regression to fit a cubic surface to the data. For example in 2D, the cubic regression equation is y = b dot x + e = [b_0, ... b_k] dot [1, x_0, x_0^2, x_0^3, x_1, x_1^2, x_1^3, x_0x_1, x_0^2x_1, x_0*x_1^2] + e

Create a Regression object that uses multiple regression to fit a cubic surface to the data. For example in 2D, the cubic regression equation is y = b dot x + e = [b_0, ... b_k] dot [1, x_0, x_0^2, x_0^3, x_1, x_1^2, x_1^3, x_0x_1, x_0^2x_1, x_0*x_1^2] + e

Value parameters

cross

whether to include 2-way cross/interaction terms x_i x_j (defaults to false)

cross3

whether to include 3-way cross/interaction terms x_i x_j x_k (defaults to false)

fname

the feature/variable names (defaults to null)

hparam

the hyper-parameters (defaults to Regression.hp)

intercept

whether to include the intercept term (column of ones) _1 (defaults to true)

x

the initial data/input m-by-n matrix (before quadratic term expansion) must not include an intercept column of all ones

y

the response/output m-vector

Attributes

def quadratic(x: MatrixD, y: VectorD, fname: Array[String], intercept: Boolean, cross: Boolean, hparam: HyperParameter): Regression

Create a Regression object that uses multiple regression to fit a quadratic surface to the data. For example in 2D, the quadratic regression equation is y = b dot x + e = [b_0, ... b_k] dot [1, x_0, x_0^2, x_1, x_1^2] + e

Create a Regression object that uses multiple regression to fit a quadratic surface to the data. For example in 2D, the quadratic regression equation is y = b dot x + e = [b_0, ... b_k] dot [1, x_0, x_0^2, x_1, x_1^2] + e

Value parameters

cross

whether to include 2-way cross/interaction terms x_i x_j (defaults to false)

fname

the feature/variable names (defaults to null)

hparam

the hyper-parameters (defaults to Regression.hp)

intercept

whether to include the intercept term (column of ones) _1 (defaults to true)

x

the initial data/input m-by-n matrix (before quadratic term expansion) must not include an intercept column of all ones

y

the response/output m-vector

Attributes

def rescale(x: MatrixD, y: VectorD, fname: Array[String], powers: Set[Double], intercept: Boolean, cross: Boolean, cross3: Boolean, hparam: HyperParameter, terms: Array[Xj2p]*): Regression

Create a SymbolicRegression object from a data matrix and a response vector. This method provides data rescaling via normalization

Create a SymbolicRegression object from a data matrix and a response vector. This method provides data rescaling via normalization

Value parameters

cross

whether to include 2-way cross/interaction terms x_i x_j (defaults to true)

cross3

whether to include 3-way cross/interaction terms x_i x_j x_k (defaults to false)

fname

the feature/variable names (defaults to null)

hparam

the hyper-parameters (use Regression.hp for default)

intercept

whether to include the intercept term (column of ones) _1 (defaults to true)

powers

the set of powers to raise matrix x to

terms

custom terms to add into the model, e.g., Array ((0, 1.0), (1, -2.0)) adds x0 x1^(-2)

x

the data/input m-by-n matrix (augment with a first column of ones to include intercept in model)

y

the response/output m-vector

Attributes

def rescale2(x: MatrixD, y: VectorD, fname: Array[String], powers: Set[Double], intercept: Boolean, cross: Boolean, cross3: Boolean, hparam: HyperParameter, terms: Array[Xj2p]*): Regression

Create a SymbolicRegression object from a data matrix and a response vector. This method provides data rescaling via min-max.

Create a SymbolicRegression object from a data matrix and a response vector. This method provides data rescaling via min-max.

Value parameters

cross

whether to include 2-way cross/interaction terms x_i x_j (defaults to true)

cross3

whether to include 3-way cross/interaction terms x_i x_j x_k (defaults to false)

fname

the feature/variable names (defaults to null)

hparam

the hyper-parameters (use Regression.hp for default)

intercept

whether to include the intercept term (column of ones) _1 (defaults to true)

powers

the set of powers to raise matrix x to

terms

custom terms to add into the model, e.g., Array ((0, 1.0), (1, -2.0)) adds x0 x1^(-2)

x

the data/input m-by-n matrix (augment with a first column of ones to include intercept in model)

y

the response/output m-vector

Attributes