Giter Club home page Giter Club logo

iterativehardthresholding's Introduction

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

## 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

## 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).

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("Cyclops")
install.packages("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.

iterativehardthresholding's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

egillax

iterativehardthresholding's Issues

Recommended changes after thesis research

I would like to propose some changes after I have experimented with IHT for my master's thesis. I have tried to commit the changes to another branch, but this failed (I didn't seem to have access).

The most important change is the default value for the initialRidgeVariance (Prior.R, line 53). This is set to be 1E4. This caused an inability to converge for my PLP model. I recommend changing it to 1E-1.

Secondly, the todo's for step-halving can be removed. It did not produce any desirable effects.

Lastly, in my thesis, I changed the prior type for the IHT starting prior to "laplace" (Prior.R, line 209). The default value for the initialRidgeVariance was determined with this prior type (instead of "normal"). Naturally, this means that it is not the ridge variance (but that is just a name and doesn't matter as much), but it might also mean that another default value is better when the starting prior is "normal". Whether others want to continue using "laplace" or "normal" is up to them. I used "laplace" as I read in the literature that some IHT like algorithms were initiated with Lasso, but just "normal" could also be interesting.

priorType

In the PatientLevelPrediction functionality to use IHT, it would be nice to be able to specify the prior that is used as we need this as a flag. I suggest adding priorType = "normal" to the IHT hook.

This should leave the functionality unchanged but will mean its easier to parse this on the PLP side. I am happy to make this edit and PR if this is agreed upon?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.