SymbolicRegression

scalation.modeling.SymbolicRegression
See theSymbolicRegression companion class

The SymbolicRegression object provides several factory methods.

Attributes

Companion
class
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: LinkedHashSet[Double] = ..., rpowers: LinkedHashSet[Rat] = ..., intercept: Boolean = ..., cross: Boolean = ..., cross3: Boolean = ..., hparam: HyperParameter = ..., terms: Array[Xj2p]*): SymbolicRegression

Create a SymbolicRegression 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 SymbolicRegression 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)

rpowers

the set of rational powers to raise matrix x to (allows a negative base) DON'T use the same powers for powers and rpowers

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: LinkedHashSet[Double], rpowers: LinkedHashSet[Rat], 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 (x^p or log1p(x) for p = 0)

rpowers

the set of rational powers to raise matrix x to (allows a negative base) DON'T use the same powers for powers and rpowers

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 = ...): SymbolicRegression

Create a SymbolicRegression 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 SymbolicRegression 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 = ...): SymbolicRegression

Create a SymbolicRegression 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 SymbolicRegression 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: LinkedHashSet[Double] = ..., rpowers: LinkedHashSet[Rat] = ..., intercept: Boolean = ..., cross: Boolean = ..., cross3: Boolean = ..., hparam: HyperParameter = ..., terms: Array[Xj2p]*): SymbolicRegression

Create a SymbolicRegression object from a data matrix and a response vector. This method provides data rescaling via normalization (z-transform).

Create a SymbolicRegression object from a data matrix and a response vector. This method provides data rescaling via normalization (z-transform).

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

rpowers

the set of rational powers to raise matrix x to (allows a negative base) DON'T use the same powers for powers and rpowers

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: LinkedHashSet[Double] = ..., rpowers: LinkedHashSet[Rat] = ..., intercept: Boolean = ..., cross: Boolean = ..., cross3: Boolean = ..., hparam: HyperParameter = ..., terms: Array[Xj2p]*): SymbolicRegression

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

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

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

rpowers

the set of rational powers to raise matrix x to (allows a negative base) DON'T use the same powers for powers and rpowers

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 searchSR(x: MatrixD, y: VectorD, fname: Array[String] = ..., intercept: Boolean = ..., cross: Boolean = ..., cross3: Boolean = ..., rational: Boolean = ..., hparam: HyperParameter = ..., terms: Array[Xj2p]*): BestStep

Search for a good symbolic regression model by trying several combinations of powers.

Search for a good symbolic regression model by trying several combinations of powers.

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)

rational

whether to search over rational or double powers

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 withDvars(x: MatrixD, dv: MatrixD, y: VectorD, fname: Array[String] = ..., fname_dv: Array[String] = ..., powers: LinkedHashSet[Double] = ..., rpowers: LinkedHashSet[Rat] = ..., intercept: Boolean = ..., cross: Boolean = ..., cross3: Boolean = ..., hparam: HyperParameter = ..., terms: Array[Xj2p]*): SymbolicRegression

Create a SymbolicRegression 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). Will append the columns in matrix dv. Allows for having dummy variables without raising them to powers or crossing them.

Create a SymbolicRegression 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). Will append the columns in matrix dv. Allows for having dummy variables without raising them to powers or crossing them.

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)

dv

the matrix of dummy variables (@see RegressionCat)

fname

the feature/variable names (defaults to null)

fname_dv

the feature/variable names for dummy variables (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)

rpowers

the set of rational powers to raise matrix x to (allows a negative base) DON'T use the same powers for powers and rpowers

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

Concrete fields

val powers: LinkedHashSet[Double]
val rpowers: LinkedHashSet[Rat]