observation_impute_cpp: Get imputed data

View source: R/RcppExports.R

observation_impute_cppR Documentation

Get imputed data

Description

Get imputed data

Usage

observation_impute_cpp(index_xtrain, index_s, xtrain, xtest, S)

Arguments

index_xtrain

Positive integer. Represents a sequence of row indices from xtrain, i.e. min(index_xtrain) >= 1 and max(index_xtrain) <= nrow(xtrain).

index_s

Positive integer. Represents a sequence of row indices from S, i.e. min(index_s) >= 1 and max(index_s) <= nrow(S).

xtrain

Numeric matrix.

xtest

Numeric matrix. Represents a single test observation.

S

Integer matrix of dimension n_combinations x m, where n_combinations equals the total number of sampled/non-sampled feature combinations and m equals the total number of unique features. Note that m = ncol(xtrain). See details for more information.

Details

S(i, j) = 1 if and only if feature j is present in feature combination i, otherwise S(i, j) = 0. I.e. if m = 3, there are 2^3 = 8 unique ways to combine the features. In this case dim(S) = c(8, 3). Let's call the features x1, x2, x3 and take a closer look at the combination represented by s = c(x1, x2). If this combination is represented by the second row, the following is true: S[2, 1:3] = c(1, 1, 0).

The returned object, X, is a numeric matrix where dim(X) = c(length(index_xtrain), ncol(xtrain)). If feature j is present in the k-th observation, that is S[index_[k], j] == 1, X[k, j] = xtest[1, j]. Otherwise X[k, j] = xtrain[index_xtrain[k], j].

Value

Numeric matrix

Author(s)

Nikolai Sellereite


shapr documentation built on May 4, 2023, 5:10 p.m.