R/RcppExports.R

Defines functions objective_cpp

Documented in objective_cpp

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Rcpp-based objective function for L1- or L2-regularized logistic regression
#'
#' @param beta0 intercept
#' @param beta a feature matrix
#' @param x observations
#' @param y response
#' @param lambda penalty
#' @param alpha elasticnet mixing parameter
#'
#' @return Objective function value.
#' @export
#'
#' @examples
#' if (requireNamespace("glmnet")) {
#'   x <- matrix(rnorm(100*20), 100, 20)
#'   y <- sample(1:2, 100, replace = TRUE)
#'   fit <- glmnet::cv.glmnet(x, y, family = "binomial")
#'   lambda <- fit$lambda.1se
#'   beta0 <- coef(fit, lambda)[1]
#'   beta <- coef(fit, lambda)[-1]
#'   objective_cpp(beta0, beta, t(x), y, lambda, alpha = 1)
#' }
objective_cpp <- function(beta0, beta, x, y, lambda, alpha = 0) {
    .Call(`_gsoc18saga_objective_cpp`, beta0, beta, x, y, lambda, alpha)
}
jolars/gsoc18saga documentation built on May 25, 2019, 6:24 p.m.