MyNixOS website logo
Description

Iterative Hard Thresholding Extensions to Cyclops.

Fits large-scale regression models with a penalty that restricts the maximum number of non-zero regression coefficients to a prespecified value. While Chu et al (2020) <doi:10.1093/gigascience/giaa044> describe the basic algorithm, this package uses Cyclops for an efficient implementation.

IterativeHardThresholding

Build Status codecov.io

IterativeHardThresholding is part of the HADES.

Introduction

IterativeHardThresholding is an R package for performing L_0-based regressions using Cyclops

Features

Examples

  • Cox's Proportional Hazards Model
library(Cyclops)
library(IterativeHardThresholding)
library(survival)

## data dimension
p <- 20    # number of covariates
n <- 300   # sample size

## tuning parameters
lambda <- log(n)  # BAR penalty (BIC)
xi     <- 0.1     # initial ridge penalty

## Cox model parameters
true.beta <- c(1, 0.1, 0, -1, 1, rep(0, p - 5))

## simulate data from an exponential model
x        <- matrix(rnorm(p * n, mean = 0, sd = 1), ncol = p)
ti       <- rweibull(n, shape = 1, scale = exp(-x%*%true.beta))
ui       <- runif(n, 0, 10) # Controls censoring
ci       <- rweibull(n, shape = 1, scale = ui * exp(-x%*%true.beta))
survtime <- pmin(ti, ci)
delta    <- ti == survtime; mean(delta)

cyclopsData <- createCyclopsData(Surv(survtime, delta) ~ x, modelType = "cox")
ihtPrior    <- createIhtPrior(K = 3, penalty = "bic")

cyclopsFit <- fitCyclopsModel(cyclopsData,
                             prior = ihtPrior)
coef(cyclopsFit)
  • Generalized Linear Model
library(Cyclops)
library(IterativeHardThresholding)

## data dimension
p <- 20    # number of covariates
n <- 300   # sample size

## tuning parameters
lambda <- log(n)  # BAR penalty (BIC)
xi     <- 0.1     # initial ridge penalty

## logistic model parameters
itcpt     <- 0.2 # intercept
true.beta <- c(1, 0.3, 0, -1, 1, rep(0, p - 5))

## simulate data from logistic model
x <- matrix(rnorm(p * n, mean = 0, sd = 1), ncol = p)
y <- rbinom(n, 1, 1 / (1 + exp(-itcpt - x%*%true.beta)))


# fit BAR model
cyclopsData <- createCyclopsData(y ~ x, modelType = "lr")
ihtPrior    <- createIhtPrior(K  = 3, penalty = "bic", exclude = c("(Intercept)"))

cyclopsFit <- fitCyclopsModel(cyclopsData,
                             prior = ihtPrior)
coef(cyclopsFit)

Technology

System Requirements

Requires R (version 3.2.0 or higher). Installation on Windows requires RTools (devtools >= 1.12 required for RTools34, otherwise RTools33 works fine).

Dependencies

  • Cyclops

Getting Started

  1. On Windows, make sure RTools is installed.
  2. In R, use the following commands to download and install IterativeHardThresholding:
install.packages("devtools")
library(devtools)
install_github("ohdsi/Cyclops")
install_github("ohdsi/IterativeHardThresholding")
  1. To perform a L_0-based Cyclops model fit with IHT, use the following commands in R:
library(IterativeHardThresholding)
cyclopsData <- createCyclopsData(formula, modelType = "modelType") ## TODO: Update
ihtPrior    <- createIhtPrior(K = 5, penalty = "bic")
cyclopsFit  <- fitCyclopsModel(cyclopsData, prior = ihtPrior)
coef(cyclopsFit) #Extract coefficients

Getting Involved

License

IterativeHardThresholding is licensed under Apache License 2.0.

Development

IterativeHardThresholding is being developed in R Studio.

Acknowledgments

  • This project is supported in part through the National Institutes of Health grant R01 HG006139.
Metadata

Version

1.0.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows