set.weights: Choose a combination of weights for a SPEAR object. Print...

View source: R/2_helpers.R

set.weightsR Documentation

Choose a combination of weights for a SPEAR object. Print 'SPEAR$params$weights' to see all combinations trained.

Description

Choose a combination of weights for a SPEAR object. Print 'SPEAR$params$weights' to see all combinations trained.

Usage

set.weights(w.idx = NULL, w.x = NULL, w.y = NULL, method = "sd")

Arguments

w.idx

Use a manual weight index (row from 'SPEAR$params$weights')? Defaults to 'NULL'

method

Which method to use? Needs to be from a '$train.spear(cv = TRUE)' object. Can be '"min"' (overall lowest mean cross validated loss), or '"sd"' (take highest weight within 1 sd cross validated loss).

Examples

SPEARobj <- SPEAR$new(...)

SPEARobj$train.spear(cv = TRUE)

# Set the weights
SPEARobj$set.weights()
SPEARobj$set.weights(w.x = 0.1)
SPEARobj$set.weights(w.idx = 1)
SPEARobj$set.weights(method = "sd")

jgygi/SPEAR documentation built on July 5, 2023, 5:35 p.m.