bara_optimize_ext: This function can be used to optimize the number of...

Description Usage Arguments Value

Description

This function is used to estimate the optimal number of dimensions to retain when normalizing with BARA. The optimization is performed using an external test set, ideally affected by batch effects.

Usage

1
2
3
4
5
6
bara_optimize_ext(x_train, ref_train, y_train, x_test, ref_test, y_test,
  fit_fun, pred_fun, perf_fun = NULL, batch_test = NULL,
  perf_objective = c("maximize", "minimize"), max_dim = 100,
  frac_rm = 0.05, fit_args = NULL, pred_args = NULL,
  perf_args = NULL, scale_var = FALSE, verbose = TRUE, cores = 1,
  .export = NULL, .packages = NULL, seed = 16438)

Arguments

x_train

Matrix, training data set. Samples in rows.

ref_train

Numeric vector, index of reference samples in the training set.

y_train

Response variables corresponding to the training set.

x_test

Matrix, test data set. Samples in rows.

ref_test

Numeric vector, index of reference samples in the test set.

y_test

Response variable corresponding to the test set.

fit_fun

Function, fits a prediction object from the training data. The function must take the following arguments:

  • x: A matrix corresponding to the compressed training data.

  • y: The response variable corresponding to y_train.

  • ...: See details for additional arguments passed to the function.

pred_fun

Function, classifies the samples in the test set and returns the predictions. The function must have the following parameters:

  • object: The object returned by fit_fun.

  • x: A matrix corresponding to the compressed test set.

  • ...: See details for additional arguments.

perf_fun

Function, estimates the performance of the generated predictions. The performance should be returned as a numeric value. This parameter can also be left to the default value of NULL if no performance scores should be calculated. If a function is passed. it must have the the following parameters:

  • y: The response variable corresponding to the y_test argument.

  • pred: The predictions generated with pred_fun.

  • ...: See details for additional arguments.

batch_test

Character/numeric/factor, describing the batch belongings of the test set.

perf_objective

Character, either "maximize" or "minimize". Should the performance metric be maximized or minimized?

max_dim

Numeric, determines the maximum number of dimensions to retain. This parameter can be decreased to reduce computational time. Default value is 100.

frac_rm

Numeric between 0 and 1. How large fraction of the dimensions should be dropped in each iteration. For example, if frac_rm = 0.05, the number of dimensions retained decreases with 5 percent in each iteration.

fit_args

List with arguments passed to fit_fun.

pred_args

List with arguments passed to pred_fun.

perf_args

List with arguments passed to perf_fun.

scale_var

Logical, should the variances be standardized. The default value is FALSE

verbose

Logical, should runtime messages be displayed? Default value is TRUE

cores

Integer, number of cores to use for computations.

.export

Variables that any of fit_fun, pred_fun or fit_fun depends on. Any input is passed on to foreach.

.packages

Packages that any of fit_fun, pred_fun or fit_fun depends on. Any input is passed on to foreach.

seed

Integer, seed for reproducible computations.

Value

An object of class BaraOpt containing:


robingradin/bara documentation built on May 9, 2019, 2:24 a.m.