Packages

class NeuralNet_Classif_XL extends NeuralNet_XL

The NeuralNet_Classif_XL class supports multi-output, multi-layer (input, {hidden} and output) Neural-Network classifiers. Given several input vectors and output vectors (training data), fit the parameters connecting the layers, so that for a new input vector 'v', the net can classify the output value. Note: 'f.last' is set to 'f_sigmoid'

Linear Supertypes
NeuralNet_XL, PredictorMat2, Predictor, Model, Error, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NeuralNet_Classif_XL
  2. NeuralNet_XL
  3. PredictorMat2
  4. Predictor
  5. Model
  6. Error
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new NeuralNet_Classif_XL(x: MatriD, y: VectoI, nz: Array[Int] = null, fname_: Strings = null, hparam: HyperParameter = NeuralNet_Classif_XL.hp, f: Array[AFF] = Array (f_tanh, f_tanh, f_sigmoid))

    x

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

    y

    the m output vector (training data consisting of m output integer values)

    nz

    the number of nodes in each hidden layer, e.g., Array (9, 8) => 2 hidden of sizes 9 and 8

    fname_

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

    hparam

    the hyper-parameters for the model/network

    f

    the array of activation function families between every pair of layers

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val _1: VectorD
    Attributes
    protected
    Definition Classes
    PredictorMat2
  5. def analyze(x_: MatriD = x, y_: VectoD = y(0), x_e: MatriD = x, y_e: VectoD = y(0)): PredictorMat2

    Analyze a dataset using this model using ordinary training with the 'train' method.

    Analyze a dataset using this model using ordinary training with the 'train' method. Only uses the first output variable's value.

    x_

    the data/input matrix (training/full)

    y_

    the response/output vector (training/full)

    x_e

    the data/input matrix (testing/full)

    y_e

    the response/output vector (testing/full)

    Definition Classes
    PredictorMat2Predictor
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. var b: IndexedSeq[NetParam]
    Attributes
    protected
    Definition Classes
    NeuralNet_XL
  8. def backwardElim(cols: Set[Int], index_q: Int = index_rSqBar, first: Int = 1): (Int, PredictorMat2)

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

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

    cols

    the columns of matrix x currently included in the existing model

    index_q

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

    first

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

    Definition Classes
    PredictorMat2
    See also

    Fit for index of QoF measures.

  9. def backwardElimAll(index_q: Int = index_rSqBar, first: Int = 1, cross: Boolean = true): (Set[Int], MatriD)

    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.

    index_q

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

    first

    first variable to consider for elimination

    cross

    whether to include the cross-validation QoF measure

    Definition Classes
    PredictorMat2
    See also

    Fit for index of QoF measures.

  10. def buildModel(x_cols: MatriD): NeuralNet_XL

    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.

    x_cols

    the columns that the new model is restricted to

    Definition Classes
    NeuralNet_XLPredictorMat2
  11. def classify(v: MatriD = x): VectoI

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

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

    v

    the input matrix

  12. def classify(v: VectoD): Int

    Given a new input vector 'v', classify the output/response value 'f(v)'.

    Given a new input vector 'v', classify the output/response value 'f(v)'.

    v

    the new input vector

  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  14. def compute_df_m(n: Array[Int]): Int

    Compute the degrees of freedom for the model (based on nx, n's, ny = 1).

    Compute the degrees of freedom for the model (based on nx, n's, ny = 1). Rough extimate based on total number of parameters - 1. FIX: use better estimate

    n

    the number of nodes in each hidden layer

    Definition Classes
    NeuralNet_XL
  15. def compute_nz(nx: Int, ny: Int): Array[Int]

    Compute default values for the number nodes in each hidden layer, based on the number of nodes in the input and output layers using average of prior layer and output layer rule.

    Compute default values for the number nodes in each hidden layer, based on the number of nodes in the input and output layers using average of prior layer and output layer rule. Rule [2] (nx + ny) / 2, (nx + 3ny) / 4, ...

    nx

    the number of nodes in the input layer

    ny

    the number of nodes in the output layer

    Definition Classes
    NeuralNet_XL
  16. def compute_nz(nx: Int): Array[Int]

    Compute default values for the number nodes in each hidden layer, based on the number of nodes in the input layer using the drop one/two rule.

    Compute default values for the number nodes in each hidden layer, based on the number of nodes in the input layer using the drop one/two rule. Rule [1] nx, nx - 2, ...

    nx

    the number of nodes in the input layer

    Definition Classes
    NeuralNet_XL
  17. def confusion(yp: VectoI, yy: VectoI = y): MatriI

    Compare the actual class 'y' vector versus the predicted class 'yp' vector, returning the confusion matrix 'cmat', which for 'k = 2' is

    Compare the actual class 'y' vector versus the predicted class 'yp' vector, returning the confusion matrix 'cmat', which for 'k = 2' is

    yp 0 1 ---------- y 0 | tn fp | 1 | fn tp | ----------

    Note: ScalaTion's confusion matrix is Actual × Predicted, but to swap the position of actual 'y' (rows) with predicted 'yp' (columns) simply use 'cmat.t', the transpose of 'cmat'.

    yp

    the precicted class values/labels

    yy

    the actual class values/labels for full (y) or test (y_e) dataset

    See also

    www.dataschool.io/simple-guide-to-confusion-matrix-terminology

  18. def contrast(yp: VectoI, yy: VectoI = y): Unit

    Contract the actual class 'y' vector versus the predicted class 'yp' vector.

    Contract the actual class 'y' vector versus the predicted class 'yp' vector.

    yp

    the precicted class values/labels

    yy

    the actual class values/labels for full (y) or test (y_e) dataset

  19. def corrMatrix(xx: MatriD): MatriD

    Return the correlation matrix for the columns in data matrix 'xx'.

    Return the correlation matrix for the columns in data matrix 'xx'.

    xx

    the data matrix shose correlation matrix is sought

    Definition Classes
    Predictor
  20. def crossValidate(k: Int = 10, rando: Boolean = true): Array[Statistic]
    Definition Classes
    PredictorMat2
  21. def crossValidateRand(nx: Int = 10, show: Boolean = false): Array[Statistic]

    Test the accuracy of the classified results by cross-validation, returning the Quality of Fit (QoF) measures such as accuracy.

    Test the accuracy of the classified results by cross-validation, returning the Quality of Fit (QoF) measures such as accuracy. This method randomizes the instances/rows selected for the test dataset.

    nx

    number of folds/crosses and cross-validations (defaults to 10x).

    show

    the show flag (show result from each iteration)

  22. val df_m: Int
    Definition Classes
    NeuralNet_XL
  23. var ee: MatriD
    Attributes
    protected
    Definition Classes
    PredictorMat2
  24. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  26. var eta: Double
    Attributes
    protected
    Definition Classes
    PredictorMat2
  27. def eval(ym: Double, y_e: VectoD, yp: VectoD): PredictorMat2

    Compute the error (difference between actual and predicted) and useful diagnostics for the test dataset.

    Compute the error (difference between actual and predicted) and useful diagnostics for the test dataset. Requires predicted responses to be passed in.

    ym

    the training/full mean actual response/output vector

    y_e

    the test/full actual response/output vector

    yp

    the test/full predicted response/output vector

    Definition Classes
    PredictorMat2
  28. def eval(x_e: MatriD, y_e: MatriD): PredictorMat2

    Evaluate the quality of the fit for the parameter/weight matrices on the entire dataset or the test dataset.

    Evaluate the quality of the fit for the parameter/weight matrices on the entire dataset or the test dataset. Considers all the response/output variables/columns.

    x_e

    the test/full data/input data matrix

    y_e

    the test/full response/output response matrix

    Definition Classes
    PredictorMat2
  29. def eval(x_e: MatriD = x, y_e: VectoD = y.col(0)): PredictorMat2

    Evaluate the quality of the fit for the parameter/weight matrices on the entire dataset or the test dataset.

    Evaluate the quality of the fit for the parameter/weight matrices on the entire dataset or the test dataset. Only considers the first response/output variable/column.

    x_e

    the test/full data/input matrix

    y_e

    the test/full response/output vector (first column only)

    Definition Classes
    PredictorMat2Model
  30. val fitA: Array[Fit]
    Definition Classes
    PredictorMat2
  31. def fitLabel: Seq[String]

    Return the labels for the quality of fit measures.

    Return the labels for the quality of fit measures.

    Definition Classes
    PredictorMat2
  32. def fitMap: IndexedSeq[Map[String, String]]

    Return 'fitMap' results for each y-column and print the overall 'rSq' average over all y-columns.

    Return 'fitMap' results for each y-column and print the overall 'rSq' average over all y-columns.

    Definition Classes
    PredictorMat2
  33. final def flaw(method: String, message: String): Unit
    Definition Classes
    Error
  34. var fname: analytics.Strings
    Attributes
    protected
    Definition Classes
    PredictorMat2
  35. def forwardSel(cols: Set[Int], index_q: Int = index_rSqBar): (Int, PredictorMat2)

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

    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.

    cols

    the columns of matrix x currently included in the existing model

    index_q

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

    Definition Classes
    PredictorMat2Predictor
    See also

    Fit for index of QoF measures.

  36. def forwardSelAll(index_q: Int = index_rSqBar, cross: Boolean = true): (Set[Int], MatriD)

    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.

    index_q

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

    cross

    whether to include the cross-validation QoF measure

    Definition Classes
    PredictorMat2
    See also

    Fit for index of QoF measures.

  37. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  38. def getNetParam(layer: Int = 1): NetParam

    Return the network parameters (weights and biases) for the given 'layer'.

    Return the network parameters (weights and biases) for the given 'layer'.

    layer

    the layer to get the parameters from

    Definition Classes
    NeuralNet_XL
  39. def getX: MatriD

    Return the data matrix 'x'.

    Return the data matrix 'x'. Mainly for derived classes where 'x' is expanded from the given columns in 'x_', e.g., QuadRegression add squared columns.

    Definition Classes
    PredictorMat2Predictor
  40. def getY: VectoD

    Return the first response vector 'y.col(0)'.

    Return the first response vector 'y.col(0)'. Mainly for derived classes where 'y' is transformed.

    Definition Classes
    PredictorMat2Predictor
  41. def getYY: MatriD

    Return the response matrix 'y'.

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

    Definition Classes
    PredictorMat2
  42. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  43. def hparameter: HyperParameter

    Return the hyper-parameters.

    Return the hyper-parameters.

    Definition Classes
    PredictorMat2Model
  44. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  45. val itran: FunctionV_2V
    Definition Classes
    NeuralNet_XL
  46. val layers: Range
    Attributes
    protected
    Definition Classes
    NeuralNet_XL
  47. val m: Int
    Attributes
    protected
    Definition Classes
    PredictorMat2
  48. val modelConcept: URI

    An optional reference to an ontological concept

    An optional reference to an ontological concept

    Definition Classes
    Model
  49. def modelName: String

    An optional name for the model (or modeling technique)

    An optional name for the model (or modeling technique)

    Definition Classes
    Model
  50. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  51. val nl: Int
    Attributes
    protected
    Definition Classes
    NeuralNet_XL
  52. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  53. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  54. val nx: Int
    Attributes
    protected
    Definition Classes
    PredictorMat2
  55. val ny: Int
    Attributes
    protected
    Definition Classes
    PredictorMat2
  56. def parameter: VectoD

    Return the parameter/weight vector (first layer, first output).

    Return the parameter/weight vector (first layer, first output).

    Definition Classes
    PredictorMat2Model
  57. def parameters: NetParams

    Return the parameters (weight matrices and bias vectors).

    Return the parameters (weight matrices and bias vectors).

    Definition Classes
    NeuralNet_XLPredictorMat2
  58. def predict(z: MatriD = x): VectoD

    Given a new input matrix 'z', predict the output/response matrix 'f(z)'.

    Given a new input matrix 'z', predict the output/response matrix 'f(z)'. Return only the first output variable's value.

    z

    the new input matrix

    Definition Classes
    PredictorMat2Predictor
  59. def predict(z: VectoD): Double

    Given a new input vector 'z', predict the output/response value 'f(z)'.

    Given a new input vector 'z', predict the output/response value 'f(z)'. Return only the first output variable's value.

    z

    the new input vector

    Definition Classes
    PredictorMat2Predictor
  60. def predict(z: VectoI): Double

    Given a new discrete data/input vector 'z', predict the 'y'-value of 'f(z)'.

    Given a new discrete data/input vector 'z', predict the 'y'-value of 'f(z)'.

    z

    the vector to use for prediction

    Definition Classes
    Predictor
  61. def predictV(v: MatriD = x): MatriD

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

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

    v

    the input matrix

    Definition Classes
    NeuralNet_XLPredictorMat2
  62. def predictV(v: VectoD): VectoD

    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)'.

    v

    the new input vector

    Definition Classes
    NeuralNet_XLPredictorMat2
  63. def report: String

    Return a basic report on the trained model.

    Return a basic report on the trained model.

    Definition Classes
    PredictorMat2Model
    See also

    'summary' method for more details

  64. def reset(eta_: Double): Unit

    Reset the learning rate 'eta'.

    Reset the learning rate 'eta'. Since this hyper-parameter needs frequent tuning, this method is provided to facilitate that.

    eta_

    the learning rate

    Definition Classes
    PredictorMat2
  65. def resetDF(df_update: PairD): Unit

    Reset the degrees of freedom to the new updated values.

    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. Caveat: only applies to the first response/output variable.

    df_update

    the updated degrees of freedom (model, error)

    Definition Classes
    PredictorMat2
  66. def residual: VectoD

    Return the vector of residuals/errors for first response/output variable/column.

    Return the vector of residuals/errors for first response/output variable/column.

    Definition Classes
    PredictorMat2Predictor
  67. def residuals: MatriD

    Return the matrix of residuals/errors.

    Return the matrix of residuals/errors.

    Definition Classes
    PredictorMat2
  68. val sizes: Array[Int]
    Attributes
    protected
    Definition Classes
    NeuralNet_XL
  69. def summary(b: VectoD = null, show: Boolean = false): String

    Produce a summary report with diagnostics and the overall quality of fit.

    Produce a summary report with diagnostics and the overall quality of fit.

    b

    the parameters of the model

    show

    flag indicating whether to print the summary

  70. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  71. def test(modelName: String, doPlot: Boolean = true): Unit

    Test the model on the full dataset (i.e., train and evaluate on full dataset).

    Test the model on the full dataset (i.e., train and evaluate on full dataset).

    modelName

    the name of the model being tested

    doPlot

    whether to plot the actual vs. predicted response

    Definition Classes
    Predictor
  72. def toString(): String
    Definition Classes
    AnyRef → Any
  73. def train(x_: MatriD = x, y_: MatriD = y): NeuralNet_XL

    Given training data 'x_' and 'y_', fit the parameters 'b' (weight matrices and bias vectors).

    Given training data 'x_' and 'y_', fit the parameters 'b' (weight matrices and bias vectors). Iterate over several epochs, where each epoch divides the training set into 'nbat' batches. Each batch is used to update the weights.

    x_

    the training/full data/input matrix

    y_

    the training/full response/output matrix

    Definition Classes
    NeuralNet_XLPredictorMat2
  74. def train(x_: MatriD, y_: VectoD): PredictorMat2

    Given data matrix 'x_' and response vector 'y_', fit the parameter 'b' (weights and biases).

    Given data matrix 'x_' and response vector 'y_', fit the parameter 'b' (weights and biases).

    x_

    the training/full data/input matrix

    y_

    the training/full response/output vector, e.g., for the first variable/column

    Definition Classes
    PredictorMat2Model
  75. def train0(x_: MatriD = x, y_: MatriD = y): NeuralNet_XL

    Given training data 'x_' and 'y_', fit the parameters 'b' (weight matrices and bias vectors).

    Given training data 'x_' and 'y_', fit the parameters 'b' (weight matrices and bias vectors). Iterate over several epochs (no batching). b.w(l) *= 1.0 - eta * (lambda / m) // regularization factor, weight decay

    x_

    the training/full data/input matrix

    y_

    the training/full response/output matrix

    Definition Classes
    NeuralNet_XLPredictorMat2
  76. def train2(x_: MatriD = x, y_: MatriD = y): NeuralNet_XL

    Given training data 'x_' and 'y_', fit the parameters 'b' (weight matrices and bias vectors).

    Given training data 'x_' and 'y_', fit the parameters 'b' (weight matrices and bias vectors). Iterate over several epochs, where each epoch divides the training set into 'nbat' batches. Each batch is used to update the weights. This version preforms an interval search for the best 'eta' value.

    x_

    the training/full data/input matrix

    y_

    the training/full response/output matrix

    Definition Classes
    NeuralNet_XLPredictorMat2
  77. def trainSwitch(which: Int, x_: MatriD = x, y_: MatriD = y): PredictorMat2

    Switch between 'train' methods: simple (0), regular (1) and hyper-parameter optimizing (2).

    Switch between 'train' methods: simple (0), regular (1) and hyper-parameter optimizing (2).

    which

    the kind of 'train' method to use

    x_

    the training/full data/input matrix

    y_

    the training/full response/output matrix

    Definition Classes
    PredictorMat2
  78. def vif(skip: Int = 1): VectoD

    Compute the Variance Inflation Factor 'VIF' for each variable to test for multi-collinearity by regressing 'x_j' against the rest of the variables.

    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 10 indicates that over 90% 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.

    skip

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

    Definition Classes
    PredictorMat2
  79. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  81. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from NeuralNet_XL

Inherited from PredictorMat2

Inherited from Predictor

Inherited from Model

Inherited from Error

Inherited from AnyRef

Inherited from Any

Ungrouped