Giter Club home page Giter Club logo

penaltylearning's Introduction

Algorithms for supervised learning of penalty functions for change detection

https://travis-ci.org/tdhock/penaltyLearning.png?branch=master

This R package provides a practical implementation of the algorithms described in our ICML’13 paper, Learning Sparse Penalties for Change-point Detection using Max Margin Interval Regression. This package can be used to learn a penalty function for predicting highly accurate changepoints in labeled data sets such as neuroblastoma. The main advantage of this method is increased accuracy, relative to unsupervised methods (such as information criteria: AIC, BIC, etc). In particular, since we have labels that indicate where there should and should not be changepoints, we can use them to learn a highly accurate penalty function which minimizes the number of incorrectly predicted labels. The learned penalty function can be used for predicting the number of changepoints in other data (even in data without labels).

Installation

From CRAN:

install.packages("penaltyLearning")

From GitHub:

if(!require(devtools))install.packages("devtools")
devtools::install_github("tdhock/penaltyLearning")

Usage

See my useR2017 tutorial on Supervised changepoint detection [video], which explains how to use penaltyLearning in detail. [GitHub repo with links to additional course materials]

penaltylearning's People

Contributors

aldro61 avatar tdhock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

penaltylearning's Issues

IRCV error when features lack colnames

> penaltyLearning::IntervalRegressionCV(set.data$train$features, target.mat)
Error in finite.features[, train.feature.names, drop = FALSE] : 
  subscript out of bounds

TODO more informative error.

BUG: 'length(x) = 2 > 1' in coercion to 'logical(1)' - R CMD check++

FYI, adding the following to ~/.Renviron:

## Supported since R (>= 3.4.0)
_R_CHECK_LENGTH_1_CONDITION_=true

## Supported since R (>= 3.6.0)
_R_CHECK_LENGTH_1_LOGIC2_=true

produces the following R CMD check --as-cran error:

* using log directory ‘/home/hb/repositories/future/revdep/checks/penaltyLearning/old/penaltyLearnin
g.Rcheck’
* using R version 3.6.0 (2019-04-26)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using options ‘--no-manual --no-build-vignettes’
* checking for file ‘penaltyLearning/DESCRIPTION’ ... OK
* this is package ‘penaltyLearning’ version ‘2018.09.04’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘penaltyLearning’ can be installed ... NOTE
Found the following notes/warnings:
  Non-staged installation was used
See ‘/home/hb/repositories/future/revdep/checks/penaltyLearning/old/penaltyLearning.Rcheck/00install
.out’ for details.
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... OK
* checking examples ... ERROR
Running examples in ‘penaltyLearning-Ex.R’ failed
The error most likely occurred in:

> ### Name: featureMatrix
> ### Title: featureMatrix
> ### Aliases: featureMatrix
> 
> ### ** Examples
> 
> 
> data(neuroblastoma, package="neuroblastoma", envir=environment())
> 
> one <- subset(neuroblastoma$profiles, profile.id %in% c(1,2))
> f.mat <- featureMatrix(one, c("profile.id", "chromosome"), "logratio")
Error in is.character(problem.vars) && sum(is.na(problem.vars) == 0) &&  : 
  'length(x) = 2 > 1' in coercion to 'logical(1)'
Calls: featureMatrix
Execution halted
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... ERROR
  Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
  > library(testthat)
  > test_check("penaltyLearning")
  Loading required package: penaltyLearning
  Loading required package: data.table
  ── 1. Error: (unknown) (@test-features.R#29)  ──────────────────────────────────
  'length(x) = 2 > 1' in coercion to 'logical(1)'
  1: featureMatrix(three, c("profile.id", "chromosome"), "logratio") at testthat/test-features.R:29
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 63 SKIPPED: 0 WARNINGS: 0 FAILED: 1
  1. Error: (unknown) (@test-features.R#29) 
  
  Error: testthat unit tests failed
  Execution halted
* DONE
Status: 2 ERRORs, 1 NOTE

This could be upstreams - I haven't investigated.

future::future_lapply() -> future.apply::future_lapply()

Hi. future::future_lapply() is deprecated since future 1.8.0. I'm about to release future 1.9.0 where it's defunct. Please use future.apply::future_lapply() instead.

R CMD check on penaltyLearning 2017.12.08 gives with future (> 1.8.1):

ERROR
Running the tests intests/testthat.Rfailed.
Last 13 lines of output:
  Actual message: "The implementation of future_lapply() in the 'future' package is defunct. Please use the one in the 'future.apply' package instead."

  ── 3. Failure: error for NA and constant features (@test-errors.R#124)  ────────
  `{ ... }` threw an error with unexpected message.
  Expected match: "after filtering NA and constant features, none remain for training"
  Actual message: "The implementation of future_lapply() in the 'future' package is defunct. Please use the one in the 'future.apply' package instead."

  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 50 SKIPPED: 0 FAILED: 3
  1. Error: (unknown) (@test-demo8.R#8) 
  2. Failure: error for constant features (@test-errors.R#110) 
  3. Failure: error for NA and constant features (@test-errors.R#124) 

  Error: testthat unit tests failed
  Execution halted

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.