Model

scalation.modeling.Model
See theModel companion object
trait Model

The Model trait provides a common framework for all models and serves as base trait for Classifier, Forecaster, Predictor, and PredictorMV traits. The train and test methods must be called first, e.g., val model = NullModel (y) model.train (null, y) model.test (null, y)

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Classifier
class BaggingTrees
class RandomForest
class HiddenMarkov
class NaiveBayes
class NaiveBayesR
class NullModel
class SimpleLDA
class TANBayes
class VAR
class VARX
trait ForecasterX
trait Forecast
class AR_Star
class Forecaster
class AR
class ARMA
class Forecaster_D
class ARX_D
class NARX_SR_D
class ARX_Quad_D
class ARX_SR_D
class ARY_D
class ARX
class ARX_Quad
class ARX_SR
class ARY
class ARY_Quad
class SARY
class NullModel
class RandomWalk
class RandomWalkS
class TrendModel
class CNN_2D
trait PredictorMV
class CNN_1D
class NeuralNet_2L
class NeuralNet_3L
class NeuralNet_XL
class RegressionMV
trait Predictor
class ELM_3L1
class NullModel
class Perceptron
class QuantileReg
class Regression
Show all

Members list

Value members

Abstract methods

def crossValidate(k: Int = ..., rando: Boolean = ...): Array[Statistic]

Return the best model found from feature selection.

Return the best model found from feature selection.

Attributes

def getFname: Array[String]

Return the feature/variable names.

Return the feature/variable names.

Attributes

def getX: MatrixD

Return the used data matrix x. Mainly for derived classes where x is expanded from the given columns in x_, e.g., SymbolicRegression.quadratic adds squared columns.

Return the used data matrix x. Mainly for derived classes where x is expanded from the given columns in x_, e.g., SymbolicRegression.quadratic adds squared columns.

Attributes

def getY: VectorD

Return the used response vector y. Mainly for derived classes where y is transformed, e.g., TranRegression, ARX.

Return the used response vector y. Mainly for derived classes where y is transformed, e.g., TranRegression, ARX.

Attributes

Return the model hyper-parameters (if none, return null). Hyper-parameters may be used to regularize parameters or tune the optimizer.

Return the model hyper-parameters (if none, return null). Hyper-parameters may be used to regularize parameters or tune the optimizer.

Attributes

def inSample_Test(skip: Int = ..., showYp: Boolean = ...): (VectorD, VectorD)

Perform In-Sample Testing, i.e., train and test on the same FULL data set. Good for initial testing and understanding variable relationships. Return the prediction and the Quality of Fit.

Perform In-Sample Testing, i.e., train and test on the same FULL data set. Good for initial testing and understanding variable relationships. Return the prediction and the Quality of Fit.

Value parameters

showYp

whether to show the prediction vector

skip

the number of initial data points to skip (due to insufficient information)

Attributes

Note

May lead to over-fitting for complex models.

Return the vector of model parameter/coefficient values. Single output models have VectorD parameters, while multi-output models have MatrixD.

Return the vector of model parameter/coefficient values. Single output models have VectorD parameters, while multi-output models have MatrixD.

Attributes

def predict(z: VectorD): Double | VectorD

Predict the value of y = f(z) by evaluating the model equation. Single output models return Double, while multi-output models return VectorD.

Predict the value of y = f(z) by evaluating the model equation. Single output models return Double, while multi-output models return VectorD.

Value parameters

z

the new vector to predict

Attributes

def test(x_: MatrixD, y_: VectorD): (VectorD, VectorD)

Test/evaluate the model's Quality of Fit (QoF) and return the predictions and QoF vectors. This may include the importance of its parameters (e.g., if 0 is in a parameter's confidence interval, it is a candidate for removal from the model). Extending traits and classes should implement various diagnostics for the test and full (training + test) datasets.

Test/evaluate the model's Quality of Fit (QoF) and return the predictions and QoF vectors. This may include the importance of its parameters (e.g., if 0 is in a parameter's confidence interval, it is a candidate for removal from the model). Extending traits and classes should implement various diagnostics for the test and full (training + test) datasets.

Value parameters

x_

the testing/full data/input matrix (impl. classes may default to x)

y_

the testing/full response/output vector (impl. classes may default to y)

Attributes

def train(x_: MatrixD, y_: VectorD): Unit

Train the model 'y_ = f(x_) + e' on a given dataset, by optimizing the model parameters in order to minimize error '||e||' or maximize log-likelihood 'll'.

Train the model 'y_ = f(x_) + e' on a given dataset, by optimizing the model parameters in order to minimize error '||e||' or maximize log-likelihood 'll'.

Value parameters

x_

the training/full data/input matrix (impl. classes may default to x)

y_

the training/full response/output vector (impl. classes may default to y)

Attributes

def validate(rando: Boolean = ..., ratio: Double = ...)(idx: IndexedSeq[Int] = ...): (VectorD | MatrixD, VectorD | MatrixD)

Concrete methods

def equation: String

Print the model prediction equation in readable form. Override per model.

Print the model prediction equation in readable form. Override per model.

Attributes

def equationLaTeX: String

Print the model prediction equation in LaTex form. Override per model.

Print the model prediction equation in LaTex form. Override per model.

Attributes

def getXy: MatrixD

Return the data matrix x concatenated with response vector y.

Return the data matrix x concatenated with response vector y.

Attributes

def getYY: MatrixD

Return the used response matrix y, if needed.

Return the used response matrix y, if needed.

Attributes

See also

neuralnet.PredictorMV

inline def modelName: String

Get the model name.

Get the model name.

Attributes

def qof2Stat(qof: VectorD): Array[Statistic]

Convert QoF results into an array (of size 1) of Statistic for compatibility with the crossValidate method.

Convert QoF results into an array (of size 1) of Statistic for compatibility with the crossValidate method.

Value parameters

qof

the Quality of Fit (QoF) results

Attributes

def report(ftVec: VectorD): String

Return a basic report on a trained and tested model.

Return a basic report on a trained and tested model.

Value parameters

ftVec

the vector of qof values produced by the Fit trait

Attributes

def report(ftMat: MatrixD): String

Return a basic report on a trained and tested multi-variate model.

Return a basic report on a trained and tested multi-variate model.

Value parameters

ftMat

the matrix of qof values produced by the Fit trait

Attributes

def screen(xy: MatrixD, thr1: Double = ..., thr2: Double = ...)(dep: MatrixD = ...): (MatrixD, VectorI)

Screen the x-columns of matrix xy based on the two thresholds, returning the reduced matrix and the column indices/predictor variables selected.

Screen the x-columns of matrix xy based on the two thresholds, returning the reduced matrix and the column indices/predictor variables selected.

Value parameters

dep

the variable/column dependency measure (defaults to correlation)

thr1

the threshold used to compare the predictor x-columns to the y-column only want variables above some minimal dependency level

thr2

the threshold used to compare the predictor x-columns with each other only want variables below some cut-off dependency/collinearity level

xy

the [ x, y ] combined data-response matrix

Attributes

inline def taskType: TaskType

Get the type of the task performed by model.

Get the type of the task performed by model.

Attributes

Concrete fields

var modelConcept: URI

The optional reference to an ontological concept

The optional reference to an ontological concept

Attributes