Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
127 lines (111 sloc) 3.94 KB
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Find Copies of Columns
#'
#' Index vector that, for each column in X, indicates the index of the first
#' copy of that column
#'
#' @param X Sparse matrix containing columns of indicator functions.
#'
index_first_copy <- function(X) {
.Call('_hal9001_index_first_copy', PACKAGE = 'hal9001', X)
}
#' Apply copy map
#'
#' OR duplicate training set columns together
#'
#' @param X Sparse matrix containing columns of indicator functions.
#' @param copy_map the copy map
#'
#' @export
#'
apply_copy_map <- function(X, copy_map) {
.Call('_hal9001_apply_copy_map', PACKAGE = 'hal9001', X, copy_map)
}
lassi_predict <- function(X, beta, intercept) {
.Call('_hal9001_lassi_predict', PACKAGE = 'hal9001', X, beta, intercept)
}
#' Sort Basis Functions
#'
#' Build a sorted list of unique basis functions based on columns, where each
#' basis function is a list
#'
#' @details Note that sorting of columns is performed such that the basis order
#' equals cols.length() and each basis function is a list(cols, cutoffs).
#'
#' @param X_sub A subset of the columns of X, the original design matrix.
#' @param cols An index of the columns that were reduced to by sub-setting.
#'
make_basis_list <- function(X_sub, cols) {
.Call('_hal9001_make_basis_list', PACKAGE = 'hal9001', X_sub, cols)
}
#' Compute Values of Basis Functions
#'
#' Computes and returns the indicator value for the basis described by
#' cols and cutoffs for a given row of X (X[row_num, ])
#'
#' @param X The design matrix, containing the original data.
#' @param row_num Numeri for a row index over which to evaluate.
#' @param cols Numeric for the column indices of the basis function.
#' @param cutoffs Numeric providing thresholds.
#'
meets_basis <- function(X, row_num, cols, cutoffs) {
.Call('_hal9001_meets_basis', PACKAGE = 'hal9001', X, row_num, cols, cutoffs)
}
#' Generate Basis Functions
#'
#' Populates a column (indexed by basis_col) of x_basis with basis indicators.
#'
#' @param basis The basis function.
#' @param X The design matrix, containing the original data.
#' @param x_basis The HAL design matrix, containing indicator functions.
#' @param basis_col Numeric indicating which column to populate.
#'
evaluate_basis <- function(basis, X, x_basis, basis_col) {
invisible(.Call('_hal9001_evaluate_basis', PACKAGE = 'hal9001', basis, X, x_basis, basis_col))
}
#' Build HAL Design Matrix
#'
#' Make a HAL design matrix based on original design matrix X and a list of
#' basis functions in argument blist
#'
#' @param X Matrix of covariates containing observed data in the columns.
#' @param blist List of basis functions with which to build HAL design matrix.
#'
#' @export
#'
make_design_matrix <- function(X, blist) {
.Call('_hal9001_make_design_matrix', PACKAGE = 'hal9001', X, blist)
}
#' Fast Coercion to Sparse Matrix
#'
#' Fast and efficient coercion of standard matrix objects to sparse matrices.
#' Borrowed from http://gallery.rcpp.org/articles/sparse-matrix-coercion/.
#' INTERNAL USE ONLY.
#'
#' @param XX_ An object of class \code{Matrix} that has a sparse structure
#' suitable for coercion to a sparse matrix format of \code{dgCMatrix}.
#'
#' @return An object of class \code{dgCMatrix}, coerced from input \code{XX_}.
#'
as_dgCMatrix <- function(XX_) {
.Call('_hal9001_as_dgCMatrix', PACKAGE = 'hal9001', XX_)
}
non_zeros <- function(X) {
.Call('_hal9001_non_zeros', PACKAGE = 'hal9001', X)
}
calc_pnz <- function(X) {
.Call('_hal9001_calc_pnz', PACKAGE = 'hal9001', X)
}
get_pnz <- function(X) {
.Call('_hal9001_get_pnz', PACKAGE = 'hal9001', X)
}
calc_xscale <- function(X, xcenter) {
.Call('_hal9001_calc_xscale', PACKAGE = 'hal9001', X, xcenter)
}
get_xscale <- function(X, xcenter) {
.Call('_hal9001_get_xscale', PACKAGE = 'hal9001', X, xcenter)
}
equal_double <- function(x, y) {
.Call('_hal9001_equal_double', PACKAGE = 'hal9001', x, y)
}
You can’t perform that action at this time.