GenRegRes-class {pRoloc} | R Documentation

## Class `"GenRegRes"` and `"ThetaRegRes"`

### Description

Regularisation framework containers.

### Objects from the Class

Object of this class are created with the respective regularisation function: `knnOptimisation`, `svmOptimisation`, `plsdaOptimisation`, `knntlOptimisation`, ...

### Slots

`algorithm`:

  Object of class `"character"` storing the machine learning algorithm name.

`hyperparameters`:

  Object of class `"list"` with the respective algorithm hyper-parameters tested.

`design`:

  Object of class `"numeric"` describing the cross-validation design, the test data size and the number of replications.

`log`:

  Object of class `"list"` with warnings thrown during the hyper-parameters regularisation.

`seed`:

  Object of class `"integer"` with the random number generation seed.

`results`:

  Object of class `"matrix"` of dimenstions `times` (see `design`) by number of hyperparameters + 1 storing the macro F1 values for the respective best hyper-parameters for each replication.

`f1Matrices`:

  Object of class `"list"` with respective `times` cross-validation F1 matrices.

`cmMatrices`:

  Object of class `"list"` with respective `times` contingency matrices.

`testPartitions`:

  Object of class `"list"` with respective `times` test partitions.

`datasize`:

  Object of class `"list"` with details about the respective inner and outter training and testing data sizes.

Only in `ThetaRegRes`:

`predictions`:

  A `list` of predictions for the optimisation iterations.

`otherWeights`:

  Alternative best theta weigts: a vector per iterations, `NULL` if no other best weights were found.

### Methods

getF1Scores

  Returns a matrix of F1 scores for the optimisation parameters.

f1Count

  `signature(object = "GenRegRes", t = "numeric")` and `signature(object = "ThetaRegRes", t = "numeric")`: Constructs a table of all possible parameter combination and count how many have an F1 scores greater or equal than `t`. When `t` is missing (default), the best F1 score is used. This method is useful in conjunctin with `plot`.

getParams

  Returns the best parameters. It is however strongly recommended to inspect the optimisation results. For a `ThetaRegRes` optimisation result, the method to chose the best parameters can be `"median"` (default) or `"mean"` (the median or mean of the best weights is chosen), `"max"` (the first weights with the highest macro-F1 score, considering that multiple max scoring combinations are possible) or `"count"` (the observed weight that get the maximum number of observations, see `f1Count`). The `favourP` argument can be used to prioritise weights that favour the primary data (i.e. heigh weights). See `favourPrimary` below.

getSeed

  Returns the seed used for the optimisation run.

getWarnings

  `signature(object = "GenRegRes")`: Returns a vector of recorded warnings.

levelPlot

  `signature(object = "GenRegRes")`: Plots a heatmap of of the optimisation results. Only for `"GenRegRes"` instances.

plot

  Plots the optisisation results.

show

  Shows the object.

### Other functions

Only for `ThetaRegRes`:

`combineThetaRegRes(object)`

  Takes a `list` of `ThetaRegRes` instances to be combined and returnes a new `ThetaRegRes` instance.

`favourPrimary(primary, auxiliary, object, verbose = TRUE)`

  Takes the `primary` and `auxiliary` data sources (two `MSnSet` instances) and a `ThetaRegRes` object and returns and updated `ThetaRegRes` instance containing best parameters/weigths (see the `getParams` function) favouring the primary data when multiple best theta weights are available.

### Author(s)

Laurent Gatto <lg390@cam.ac.uk>

### Examples

    showClass("GenRegRes")
    showClass("ThetaRegRes")

[Package pRoloc version 1.26.0 Index]