NeuralNet_3L

scalation.modeling.neuralnet.NeuralNet_3L
See theNeuralNet_3L companion object
class NeuralNet_3L(x: MatrixD, y: MatrixD, fname_: Array[String] = ..., var nz: Int = ..., hparam: HyperParameter = ..., f: AFF = ..., f1: AFF = ..., val itran: FunctionM2M = ...) extends PredictorMV, Fit

The NeuralNet_3L class supports multi-output, 3-layer (input, hidden and output) Neural-Networks. It can be used for both classification and prediction, depending on the activation functions used. Given several input vectors and output vectors (training data), fit the parameters a and b connecting the layers, so that for a new input vector v, the net can predict the output value, i.e., yp = f1 (b * f (a * v)) where f and f1 are the activation functions and the parameter a and b are the parameters between input-hidden and hidden-output layers. Unlike NeuralNet_2L which adds input x0 = 1 to account for the intercept/bias, NeuralNet_3L explicitly adds bias.

Value parameters

f

the activation function family for layers 1->2 (input to output)

f1

the activation function family for layers 2->3 (hidden to output)

fname_

the feature/variable names (if null, use x_j's)

hparam

the hyper-parameters for the model/network

itran

the inverse transformation function returns response matrix to original scale

nz

the number of nodes in hidden layer (-1 => use default formula)

x

the m-by-n input/data matrix (training data consisting of m input vectors)

y

the m-by-ny output/response matrix (training data consisting of m output vectors)

Attributes

Companion
object
Graph
Supertypes
trait Fit
trait FitM
trait PredictorMV
trait Model
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def buildModel(x_cols: MatrixD, fname2: Array[String] = ...): NeuralNet_3L

Build a sub-model that is restricted to the given columns of the data matrix.

Build a sub-model that is restricted to the given columns of the data matrix.

Value parameters

fname2

the variable/feature names for the new model (defaults to null)

x_cols

the columns that the new model is restricted to

Attributes

override def makePlots(yy_: MatrixD, yp: MatrixD): Unit

Make plots for each output/response variable (column of matrix y). Overriden as the response matrix may be transformed or rescaled.

Make plots for each output/response variable (column of matrix y). Overriden as the response matrix may be transformed or rescaled.

Value parameters

yp

the testing/full predicted response/output matrix (defaults to full y)

yy_

the testing/full actual response/output matrix (defaults to full y)

Attributes

Definition Classes

Given a new input vector v, predict the output/response vector f(v).

Given a new input vector v, predict the output/response vector f(v).

Value parameters

v

the new input vector

Attributes

override def predict(v: MatrixD = ...): MatrixD

Given an input matrix v, predict the output/response matrix f(v).

Given an input matrix v, predict the output/response matrix f(v).

Value parameters

v

the input matrix

Attributes

Definition Classes
def summary2(x_: MatrixD = ..., fname_: Array[String] = ..., b_: MatrixD = ...): String

Produce a QoF summary for a model with diagnostics for each predictor x_j and the overall Quality of Fit (QoF). FIX - only known to be valid for id activation function

Produce a QoF summary for a model with diagnostics for each predictor x_j and the overall Quality of Fit (QoF). FIX - only known to be valid for id activation function

Value parameters

b_

the parameters/coefficients for the model

fname_

the array of feature/variable names

x_

the testing/full data/input matrix

Attributes

See also
def test(x_: MatrixD = ..., y_: MatrixD = ...): (MatrixD, MatrixD)

Test a predictive model y_ = f(x_) + e and return its QoF vector. Testing may be be in-sample (on the training set) or out-of-sample (on the testing set) as determined by the parameters passed in. Note: must call train before test.

Test a predictive model y_ = f(x_) + e and return its QoF vector. Testing may be be in-sample (on the training set) or out-of-sample (on the testing set) as determined by the parameters passed in. Note: must call train before test.

Value parameters

x_

the testing/full data/input matrix (defaults to full x)

y_

the testing/full response/output matrix (defaults to full y)

Attributes

def train(x_: MatrixD = ..., y_: MatrixD = ...): Unit

Given training data x_ and y_, fit the parameters bb. Minimize the error in the prediction by adjusting the parameters bb.

Given training data x_ and y_, fit the parameters bb. Minimize the error in the prediction by adjusting the parameters bb.

Value parameters

x_

the training/full data/input matrix

y_

the training/full response/output matrix

Attributes

override def train2(x_: MatrixD = ..., y_: MatrixD = ...): Unit

Given training data x_ and y_, fit the parameters bb. Minimize the error in the prediction by adjusting the parameters bb. This version preforms an interval search for the best eta value.

Given training data x_ and y_, fit the parameters bb. Minimize the error in the prediction by adjusting the parameters bb. This version preforms an interval search for the best eta value.

Value parameters

x_

the training/full data/input matrix

y_

the training/full response/output matrix

Attributes

Definition Classes

Inherited methods

inline def PIbounds(yp: VectorD, ihw_: MatrixD): (MatrixD, MatrixD)

Attributes

Inherited from:
Fit
inline def PIbounds(yp: VectorD, ihw: VectorD): (VectorD, VectorD)

Make the PREDICTION INTERVAL (PI) lower and upper bound vectors from the point predictions and the interval half widths.

Make the PREDICTION INTERVAL (PI) lower and upper bound vectors from the point predictions and the interval half widths.

Value parameters

ihw

the vector of interval half widths (one for each prediction)

yp

the vector of point predictions (y-hat)

Attributes

Inherited from:
Fit
def backwardElim(cols: LinkedHashSet[Int], first: Int = ...)(using qk: Int): BestStep

Perform backward elimination to find the least predictive variable to remove from the existing model, returning the variable to eliminate, the new parameter matrix and the new Quality of Fit (QoF). May be called repeatedly.

Perform backward elimination to find the least predictive variable to remove from the existing model, returning the variable to eliminate, the new parameter matrix and the new Quality of Fit (QoF). May be called repeatedly.

Value parameters

cols

the columns of matrix x currently included in the existing model

first

first variable to consider for elimination (default (1) assume intercept x_0 will be in any model)

qk

index of Quality of Fit (QoF) to use for comparing quality

Attributes

See also

Fit for index of QoF measures.

Inherited from:
PredictorMV
def backwardElimAll(first: Int = ..., cross: String = ...)(using qk: Int): (LinkedHashSet[Int], ArrayBuffer[VectorD])

Perform BACKWARD ELIMINATION to find the LEAST predictive variables to remove from the full model, returning the variables left and the new Quality of Fit (QoF) measures for all steps.

Perform BACKWARD ELIMINATION to find the LEAST predictive variables to remove from the full model, returning the variables left and the new Quality of Fit (QoF) measures for all steps.

Value parameters

cross

indicator to include the cross-validation/validation QoF measure (defaults to "many")

first

first variable to consider for elimination

qk

index of Quality of Fit (QoF) to use for comparing quality

Attributes

See also

Fit for index of QoF measures.

Inherited from:
PredictorMV
def beamSelAll(cross: String = ..., bk: Int = ...)(using qk: Int): (LinkedHashSet[Int], ArrayBuffer[VectorD])

Perform BEAM SEARCH SELECTION to find a GOOD COMBINATION of predictive features/variables to have in the model, returning the top k sets of features/variables selected and the new Quality of Fit (QoF) measures/metrics for all steps. At each step, iterate over the models in the beam (top k) and create candidates by adding features (phase 1) and then removing (phase 2). From all the candidates, keep the best k and start a new iteration. Stops when there is no improvement in any of top k (or the maximum number of features is reached.

Perform BEAM SEARCH SELECTION to find a GOOD COMBINATION of predictive features/variables to have in the model, returning the top k sets of features/variables selected and the new Quality of Fit (QoF) measures/metrics for all steps. At each step, iterate over the models in the beam (top k) and create candidates by adding features (phase 1) and then removing (phase 2). From all the candidates, keep the best k and start a new iteration. Stops when there is no improvement in any of top k (or the maximum number of features is reached.

Value parameters

bk

the beam width holding the top k models (defaults to 3)

cross

indicator to include the cross-validation/validation QoF measure (defaults to "many")

qk

index of Quality of Fit (QoF) to use for comparing quality

Attributes

See also

Fit for index of QoF measures/metrics.

Inherited from:
PredictorMV
def crossValidate(k: Int = ..., rando: Boolean = ...): 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 def qof2Stat (qof: MatrixD): Array [Statistic] = val stats = Fit.qofStatTable // create table for QoF measures if qof(QoF.sst.ordinal)(0) > 0.0 then // requires variation in test-set for q <- qof.indices do stats(q).tally (qof(q)(0)) // tally these QoF measures stats end qof2Stat

Attributes

Inherited from:
PredictorMV
override def diagnose(y_raw: VectorD, yp_raw: VectorD, w: VectorD = ...): VectorD

Diagnose the health of the model by computing the Quality of Fit (QoF) measures, from the error/residual vector and the predicted & actual responses. For some models the instances may be weighted.

Diagnose the health of the model by computing the Quality of Fit (QoF) measures, from the error/residual vector and the predicted & actual responses. For some models the instances may be weighted.

Value parameters

w

the weights on the instances (defaults to null)

y_raw

the actual response/output vector to use (test/full)

yp_raw

the predicted response/output vector (test/full)

Attributes

See also

Regression_WLS

Definition Classes
Fit -> FitM
Inherited from:
Fit
def diagnose_(y: VectorD, yp: VectorD, low_up: (VectorD, VectorD), α: Double = ..., w: VectorD = ...): VectorD

Diagnose the health of the model by computing the Quality of Fit (QoF) metrics/measures, from the error/residual vector and the predicted & actual responses. For some models the instances may be weighted. This method also includes PREDICTION INTERVAL (PI) metrics/measures.

Diagnose the health of the model by computing the Quality of Fit (QoF) metrics/measures, from the error/residual vector and the predicted & actual responses. For some models the instances may be weighted. This method also includes PREDICTION INTERVAL (PI) metrics/measures.

Value parameters

low_up

the predicted (lower, upper) bounds vectors

w

the weights on the instances (defaults to null)

y

the actual response/output vector to use (test/full)

yp

the point prediction mean/median

α

the significance/nominal level of uncertainty (α) (defaults to 0.1, 10%)

Attributes

See also

otexts.com/fpp2/prediction-intervals.html Note: wis should be computed separately as the bounds are matrices.

Inherited from:
Fit
def diagnose_mat(yy: MatrixD, yyp: MatrixD, w: VectorD = ...): MatrixD

Diagnose the health of the model by computing the Quality of Fit (QoF) measures, from the predicted & actual matrix responses (output variable per column). For some models the instances may be weighted.

Diagnose the health of the model by computing the Quality of Fit (QoF) measures, from the predicted & actual matrix responses (output variable per column). For some models the instances may be weighted.

Value parameters

w

the weights on the instances (defaults to null)

yy

the actual response/output matrix to use (test/full)

yyp

the predicted response/output matrix (test/full)

Attributes

See also

Regression_WLS

Inherited from:
Fit
def diagnose_pi(y: VectorD, yp: VectorD, low_up: (MatrixD, MatrixD), α: VectorD = ..., : Int = ...): (VectorD, Int)

Diagnose the health of the model by computing the Quality of Fit (QoF) measures for both POINT PREDICTIONS and PREDICTION INTERVALS.

Diagnose the health of the model by computing the Quality of Fit (QoF) measures for both POINT PREDICTIONS and PREDICTION INTERVALS.

Value parameters

the index for the main significance level out of the vector α

low_up

the predicted (lower, upper) bounds matrices for various α levels (column for each α level)

y

the given time-series (must be aligned with the interval forecast)

yp

the point prediction mean/median

α

the vector of significance levels (defaults to the K = 11 prediction intervals used by the CDC Forecast Hub)

Attributes

Inherited from:
Fit
def diagnose_wis(y: VectorD, yp: VectorD, low_up: (MatrixD, MatrixD), α: VectorD = ...): Double

Diagnose the health of the model by computing the Quality of Fit (QoF) measures, specifically for the weighted interval score that allows using custom α levels.

Diagnose the health of the model by computing the Quality of Fit (QoF) measures, specifically for the weighted interval score that allows using custom α levels.

Value parameters

low_up

the predicted (lower, upper) bounds matrices for various α levels (column for each α level)

y

the given time-series (must be aligned with the interval forecast)

yp

the point prediction mean/median

α

the vector of significance levels (defaults to the K = 11 prediction intervals used by the CDC Forecast Hub)

Attributes

Inherited from:
Fit
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

Inherited from:
Model
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

Inherited from:
Model
override def fit: VectorD

Return the Quality of Fit (QoF) measures corresponding to the labels given. Note, if sse > sst, the model introduces errors and the rSq may be negative, otherwise, R^2 (rSq) ranges from 0 (weak) to 1 (strong). Override to add more quality of fit measures.

Return the Quality of Fit (QoF) measures corresponding to the labels given. Note, if sse > sst, the model introduces errors and the rSq may be negative, otherwise, R^2 (rSq) ranges from 0 (weak) to 1 (strong). Override to add more quality of fit measures.

Attributes

Definition Classes
Fit -> FitM
Inherited from:
Fit
def forwardSel(cols: LinkedHashSet[Int])(using qk: Int): BestStep

Perform forward selection to find the most predictive variable to add the existing model, returning the variable to add and the new model. May be called repeatedly.

Perform forward selection to find the most predictive variable to add the existing model, returning the variable to add and the new model. May be called repeatedly.

Value parameters

cols

the columns of matrix x currently included in the existing model

qk

index of Quality of Fit (QoF) to use for comparing quality

Attributes

See also

Fit for index of QoF measures.

Inherited from:
PredictorMV
def forwardSelAll(cross: String = ...)(using qk: Int): (LinkedHashSet[Int], ArrayBuffer[VectorD])

Perform FORWARD SELECTION to find the MOST predictive variables to have in the model, returning the variables added and the new Quality of Fit (QoF) measures for all steps.

Perform FORWARD SELECTION to find the MOST predictive variables to have in the model, returning the variables added and the new Quality of Fit (QoF) measures for all steps.

Value parameters

cross

indicator to include the cross-validation/validation QoF measure (defaults to "many")

qk

index of Quality of Fit (QoF) to use for comparing quality

Attributes

See also

Fit for index of QoF measures.

Inherited from:
PredictorMV

Return the best model found from feature selection.

Return the best model found from feature selection.

Attributes

Inherited from:
PredictorMV
def getFname: Array[String]

Return the feature/variable names.

Return the feature/variable names.

Attributes

Inherited from:
PredictorMV
def getX: MatrixD

Return the used data matrix x. Mainly for derived classes where x is expanded from the given columns in x_.

Return the used data matrix x. Mainly for derived classes where x is expanded from the given columns in x_.

Attributes

Inherited from:
PredictorMV
def getXy: MatrixD

Return the data matrix x concatenated with response vector y.

Return the data matrix x concatenated with response vector y.

Attributes

Inherited from:
Model
def getY: VectorD

Return the used response vector y (first colum in matrix).

Return the used response vector y (first colum in matrix).

Attributes

Inherited from:
PredictorMV

Return the y-transformation.

Return the y-transformation.

Attributes

Inherited from:
Fit
override def getYY: MatrixD

Return the used response matrix y. Mainly for derived classes where y is transformed.

Return the used response matrix y. Mainly for derived classes where y is transformed.

Attributes

Definition Classes
Inherited from:
PredictorMV
override def help: String

Return the help string that describes the Quality of Fit (QoF) measures provided by the Fit trait. Override to correspond to fitLabel.

Return the help string that describes the Quality of Fit (QoF) measures provided by the Fit trait. Override to correspond to fitLabel.

Attributes

Definition Classes
Fit -> FitM
Inherited from:
Fit

Return the hyper-parameters.

Return the hyper-parameters.

Attributes

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

Perform In-Sample Testing, i.e., train and test on the full data set. Return the prediction and the Quality of Fit.

Perform In-Sample Testing, i.e., train and test on the full data set. 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

Inherited from:
PredictorMV
def ll(ms: Double = ..., s2: Double = ..., m2: Int = ...): Double

The log-likelihood function times -2. Override as needed.

The log-likelihood function times -2. Override as needed.

Value parameters

ms

raw Mean Squared Error

s2

MLE estimate of the population variance of the residuals

Attributes

See also
Inherited from:
Fit
def mcols: LinkedHashSet[Int]

Return the set of columns (numbers) for the features in this model.

Return the set of columns (numbers) for the features in this model.

Attributes

Inherited from:
PredictorMV
inline def modelName: String

Get the model name.

Get the model name.

Attributes

Inherited from:
Model
inline def mse_: Double

Return the mean of the squares for error (sse / df). Must call diagnose first.

Return the mean of the squares for error (sse / df). Must call diagnose first.

Attributes

Inherited from:
Fit
def numTerms: Int

Return the number of terms/parameters in the model, e.g., b_0 + b_1 x_1 + b_2 x_2 has three terms.

Return the number of terms/parameters in the model, e.g., b_0 + b_1 x_1 + b_2 x_2 has three terms.

Attributes

Inherited from:
PredictorMV
def orderByY(y_: VectorD, yp_: VectorD): (VectorD, VectorD)

Order vectors y_ and yp_ accroding to the ascending order of y_.

Order vectors y_ and yp_ accroding to the ascending order of y_.

Value parameters

y_

the vector to order by (e.g., true response values)

yp_

the vector to be order by y_ (e.g., predicted response values)

Attributes

Inherited from:
PredictorMV

Return only the first matrix of parameter/coefficient values.

Return only the first matrix of parameter/coefficient values.

Attributes

Inherited from:
PredictorMV

Return the array of network parameters (weight matrix, bias vector) bb.

Return the array of network parameters (weight matrix, bias vector) bb.

Attributes

Inherited from:
PredictorMV
def predictInt(x_: MatrixD, df_: Double = ..., α: Double = ...): VectorD

Produce a PREDICTION INTERVAL half width for each prediction yp (y-hat).

Produce a PREDICTION INTERVAL half width for each prediction yp (y-hat).

Value parameters

df_

the error/residual degrees of freedom

x_

the testing/full data/input matrix

α

the significance level α = .1 for TWO TAILS: left tail .05 | 1 - α = .90 | .05 right tail e.g., for AutoMPG, t_crit (385, 0.90) = 1.6488210657096942 t_crit (385, 0.95) = 1.966

Attributes

See also

predictCInt in Predictor

stats.stackexchange.com/questions/585660/what-is-the-formula-for-prediction-interval-in-multivariate-case

Inherited from:
Fit
def predictInt_(x_: MatrixD, df_: Double = ..., α: VectorD = ...): MatrixD

Produce a PREDICTION INTERVAL half width for each prediction yp (y-hat) and each significance level.

Produce a PREDICTION INTERVAL half width for each prediction yp (y-hat) and each significance level.

Value parameters

df_

the error/residual degrees of freedom

x_

the testing/full data/input matrix

α

the significance levels to be used (defaults to Fit.α_)

Attributes

Inherited from:
Fit
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

Inherited from:
Model
inline def rSq0_: Double

Attributes

Inherited from:
FitM
inline def rSq_: Double

Return the coefficient of determination (R^2). Must call diagnose first.

Return the coefficient of determination (R^2). Must call diagnose first.

Attributes

Inherited from:
FitM
override 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

Definition Classes
Inherited from:
PredictorMV
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

Inherited from:
Model
def resetBest(): Unit

Reset the best-step to default

Reset the best-step to default

Attributes

Inherited from:
PredictorMV
def resetDF(df_update: (Double, Double)): Unit

Reset the degrees of freedom to the new updated values. For some models, the degrees of freedom is not known until after the model is built.

Reset the degrees of freedom to the new updated values. For some models, the degrees of freedom is not known until after the model is built.

Value parameters

df_update

the updated degrees of freedom (regression/model, error)

Attributes

Inherited from:
Fit

Return the matrix of residuals/errors.

Return the matrix of residuals/errors.

Attributes

Inherited from:
PredictorMV
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

Inherited from:
Model
def selectFeatures(tech: SelectionTech, cross: String = ..., first: Int = ..., swap: Boolean = ...)(using qk: Int): (LinkedHashSet[Int], ArrayBuffer[VectorD])

Perform feature selection to find the most predictive features/variables to have in the model, returning the features/variables added and the new Quality of Fit (QoF) measures/metrics for all steps.

Perform feature selection to find the most predictive features/variables to have in the model, returning the features/variables added and the new Quality of Fit (QoF) measures/metrics for all steps.

Value parameters

cross

indicator to include the cross-validation/validation QoF measure (defaults to "many")

first

first variable to consider for elimination (default (1) assume intercept x_0 will be in any model)

qk

index of Quality of Fit (QoF) to use for comparing quality

swap

whether to allow a swap step (swap out a feature for a new feature in one step)

tech

the feature selection technique to apply

Attributes

See also

Fit for index of QoF measures/metrics.

Inherited from:
FeatureSelection
def showQoF(qof: VectorD): Unit

Show the QoF metrics/measures in vector qof.

Show the QoF metrics/measures in vector qof.

Value parameters

qof

the QoF metrics (e.g., for point and interval predictions/forecasts)

Attributes

Inherited from:
Fit
inline def sse_: Double

Return the sum of the squares for error (sse). Must call diagnose first.

Return the sum of the squares for error (sse). Must call diagnose first.

Attributes

Inherited from:
FitM
def stepwiseSelAll(cross: String = ..., swap: Boolean = ...)(using qk: Int): (LinkedHashSet[Int], ArrayBuffer[VectorD])

Perform STEPWISE SELECTION to find a GOOD COMBINATION of predictive variables to have in the model, returning the variables selected and the new Quality of Fit (QoF) measures for all steps. At each step it calls 'forwardSel' and 'backwardElim' and takes the best of the two actions. Stops when neither action yields improvement.

Perform STEPWISE SELECTION to find a GOOD COMBINATION of predictive variables to have in the model, returning the variables selected and the new Quality of Fit (QoF) measures for all steps. At each step it calls 'forwardSel' and 'backwardElim' and takes the best of the two actions. Stops when neither action yields improvement.

Value parameters

cross

indicator to include the cross-validation/validation QoF measure (defaults to "many")

qk

index of Quality of Fit (QoF) to use for comparing quality

Attributes

See also

Fit for index of QoF measures.

Inherited from:
PredictorMV
override def summary(x_: MatrixD = ..., fname: Array[String] = ..., b: VectorD = ..., vifs: VectorD = ...): String

Produce a QoF SUMMARY for a model with diagnostics for each predictor x_j and the overall Quality of Fit (QoF). Note: `Fac_Cholesky is used to compute the inverse of xtx.

Produce a QoF SUMMARY for a model with diagnostics for each predictor x_j and the overall Quality of Fit (QoF). Note: `Fac_Cholesky is used to compute the inverse of xtx.

Value parameters

b

the parameters/coefficients for the model

fname

the array of feature/variable names

vifs

the Variance Inflation Factors (VIFs)

x_

the testing/full data/input matrix

Attributes

Definition Classes
Fit -> FitM
Inherited from:
Fit
inline def taskType: TaskType

Get the type of the task performed by model.

Get the type of the task performed by model.

Attributes

Inherited from:
Model
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

Inherited from:
PredictorMV
inline def testIndices(n_total: Int, n_test: Int, rando: Boolean): IndexedSeq[Int]

Return the indices for the test-set for (1) RANDONLY or (3) LAST

Return the indices for the test-set for (1) RANDONLY or (3) LAST

Value parameters

n_test

the size of test-set

n_total

the size of full dataset

rando

whether to select indices randomly or in blocks

Attributes

See also

scalation.mathstat.TnT_Split

Inherited from:
PredictorMV
inline def testIndices(n_test: Int, rando: Boolean): IndexedSeq[Int]

Return the indices for the test-set.

Return the indices for the test-set.

Value parameters

n_test

the size of test-set

rando

whether to select indices randomly or in blocks

Attributes

See also

scalation.mathstat.TnT_Split

Inherited from:
PredictorMV
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

Inherited from:
PredictorMV
def trainNtest(x_: MatrixD = ..., y_: MatrixD = ...)(xx: MatrixD = ..., yy: MatrixD = ...): (MatrixD, MatrixD)

Train and test the predictive model y_ = f(x_) + e and report its QoF and plot its predictions. FIX - currently must override if y is transformed, @see TranRegression

Train and test the predictive model y_ = f(x_) + e and report its QoF and plot its predictions. FIX - currently must override if y is transformed, @see TranRegression

Value parameters

x_

the training/full data/input matrix (defaults to full x)

xx

the testing/full data/input matrix (defaults to full x)

y_

the training/full response/output matrix (defaults to full y)

yy

the testing/full response/output matrix (defaults to full y)

Attributes

Inherited from:
PredictorMV
def trainNtest2(x_: MatrixD = ..., y_: MatrixD = ...)(xx: MatrixD = ..., yy: MatrixD = ...): (MatrixD, MatrixD)

Train and test the predictive model y_ = f(x_) + e and report its QoF and plot its predictions. This version does auto-tuning. FIX - currently must override if y is transformed, @see TranRegression

Train and test the predictive model y_ = f(x_) + e and report its QoF and plot its predictions. This version does auto-tuning. FIX - currently must override if y is transformed, @see TranRegression

Value parameters

x_

the training/full data/input matrix (defaults to full x)

xx

the testing/full data/input matrix (defaults to full x)

y_

the training/full response/output matrix (defaults to full y)

yy

the testing/full response/output matrix (defaults to full y)

Attributes

Inherited from:
PredictorMV
def validate(rando: Boolean = ..., ratio: Double = ...)(idx: IndexedSeq[Int] = ...): (MatrixD, MatrixD)

Attributes

Inherited from:
PredictorMV
def vif(skip: Int = ...): VectorD

Compute the Variance Inflation Factor (VIF) for each variable to test for multi-collinearity by regressing x_j against the rest of the variables. A VIF over 50 indicates that over 98% of the variance of x_j can be predicted from the other variables, so x_j may be a candidate for removal from the model. Note: override this method to use a superior regression technique.

Compute the Variance Inflation Factor (VIF) for each variable to test for multi-collinearity by regressing x_j against the rest of the variables. A VIF over 50 indicates that over 98% of the variance of x_j can be predicted from the other variables, so x_j may be a candidate for removal from the model. Note: override this method to use a superior regression technique.

Value parameters

skip

the number of columns of x at the beginning to skip in computing VIF

Attributes

Inherited from:
PredictorMV

Concrete fields

Inherited fields

var modelConcept: URI

The optional reference to an ontological concept

The optional reference to an ontological concept

Attributes

Inherited from:
Model