Models and training

Models and training

These are the exported modelling and training functions and types made available by ERM. See the corresponding usage page to understand how to use these methods.

Model(...)

The Model() function constructs an ERM model. The typical invocation is Model(U, V, Loss(), Reg()), where U and V specify raw inputs and targets, respectively, and Loss() specifies some type of training loss (default: SquareLoss()) and Reg() specifies some type of regularizer (default: L2Reg()). For more details, see the description of ERM models in the usage notes.

source

status(M) prints the status of the model after the most recent action performed on it.

source

Prints and returns the status of the model.

source

train(M [, lambda=1e-10, trainfrac=nothing]) This function trains a model M. The usual invocation is train(M). Users may choose to specify a different choice of regularization weight lambda. For example to specify a weight of lambda = 0.01, one invokes train(M, lambda=0.001), and to specify a different train split, one invokes train(M, trainfrac=0.75), which means that 75 percent of the data will be used for training and only 25 percent will be used for test. The default parameters are lambda = 1e-10 and trainfrac=nothing, which will result in a 80-20 train-test split.

source

trainfolds(M [,lambda=1e-10, nfolds=5])

The trainfolds function carries out n-fold cross validation on a model M. Specify regularization weight through optional argument lambda, and the number of folds through nfolds. Default: lambda=1e-10, and nfolds=5.

source

trainpath(M [,lambda=logspace(-5, 5, 100), trainfrac=0.8])

The trainpath function trains a model M over a set of regularization weights. Specify these weights by invoking the optional argument lambda, and set a train-test ratio by using the optional argument trainfrac.

Defaults:

  • lambda=logspace(-5,5,100) so training occurs over lambda between 1e-5 and

1e5.

  • trainfrac=0.8, so training occurs with a 80-20 train-test split.

Example: trainpath(M, lambda=logspace(-1, 1, 100)) trains over lambda between 0.1 and 10.

Example trainpath(M, trainfrac=0.75) trains w/ 75-25 train-test split.

source