Skip to contents

Once evaluated extract a model.

Usage

extract_model(model, models_eval, which)

Arguments

model

A matrix with the names of the blocks.

models_eval

The output of iterate_model() or search_model().

which

Either inner, outer or the row to extract the model.

Value

A matrix with the weights on the models_eval argument.

Examples

data("Russett", package = "RGCCA")
X_agric <- as.matrix(Russett[, c("gini", "farm", "rent")])
X_ind <- as.matrix(Russett[, c("gnpr", "labo")])
X_polit <- as.matrix(Russett[ , c("inst", "ecks",  "death", "demostab",
                                  "dictator")])
A <- list(Agric = X_agric, Ind = X_ind, Polit = X_polit)
C <- matrix(c(0, 0, 1, 0, 0, 1, 1, 1, 0), 3, 3)
out <- search_model(A = A, C = C, c1 =rep(1, 3), scheme = "factorial",
                    scale = FALSE, verbose = FALSE,  ncomp = rep(1, length(A)),
                    bias = TRUE, BPPARAM = BiocParallel::SerialParam())
extract_model(C, out, "inner")
#>      [,1] [,2] [,3]
#> [1,]  0.0    0  0.5
#> [2,]  0.0    0  1.0
#> [3,]  0.5    1  0.0