Learn R Programming

sparselink (version 1.0.0)

construct_weights: Construct internal and external weights

Description

Construct internal and external weights

Usage

construct_weights(coef, id)

Value

Returns a list with slots lower.limits, upper.limits, weight.source (external weights) and weight.target (internal weights). Each slot is a vector of length \(2*p\), with the first \(p\) entries for positive effects and the last \(p\) entries for negative effects.

Arguments

coef

matrix with \(p\) rows (features) and \(q\) columns (problems)

id

integer in \(1,\ldots,q\)

See Also

Use construct_penfacs to obtain penalty factors (i.e., for scaling and inverting weights).

Examples

Run this code
p <- 10
q <- 3
data <- stats::rbinom(p*q,size=1,prob=0.2)*stats::rnorm(p*q)
coef <- matrix(data=data,nrow=p,ncol=q)
construct_weights(coef=coef,id=1)

Run the code above in your browser using DataLab