README.md

Build Status codecov

TSClassification

A large number of time-series classifiers have been implemented in Java for the benchmark study The Great Time Series Classification Bake Off (Bagnall et al., 2018). Paper

The R-package tsclassification interfaces an adapted version of implementations provided by Bagnall et al. (2018), in order to make implemented algorithms available for general machine learning purposes.

Package Website

Installation

The package can be installed from Github via

devtools::install_github("compstat-lmu/tsclassification")

See the Troubleshooting section of this README for more info if the installation fails.

Usage

Note that our package name is in lowercase letters.

library(tsclassification)

We showcase the usage for a simulated data set.

First we generate some artificial data:

  data = data.frame(matrix(rnorm(500), nrow = 100))
  data$target = sample(c(1, 0), 100, replace = TRUE)
  train_set = sample(c(TRUE, FALSE), 100, replace = TRUE)

Training a model: Then we train a RotationForest model. The API is similar to python's scikit-learn API. It offers a train() method, that trains a model, and a predict() method that uses the trained model in order to predict future, unseen data.

  # Instantiate the model
  tsc = TSClassifier$new("weka.classifiers.meta.RotationForest")
  # Call train and predict function on the different data splits
  tsc$train(data[train_set, ],target = "target")
  tsc$predict(data[!train_set, ])

For a more in-depth example, please consult the vignette.

mlr3 connector

The package offers also offers connector to the machine learning toolbox mlr3. Learners contained in the package can directly be used in conjunction with the powerful functionalities of mlr3 like resampling, tuning and so on.

An example of doing this for the popular iris dataset (considering the features as "functional") is shown below:

  library(mlr3)
  tsk = mlr_tasks$get("iris")
  lrn = LearnerClassifTSClassification$new()

  # Train the classifier
  lrn$train(tsk)

  # Predict
  prds = lrn$predict(tsk)

For a more in-depth introduction to mlr3, please consult the mlr3 book. Additionally, the vignette. contains an example for tuning a time-series classifier.

Currently available classifiers:

The package currently supports most of the algorithms implemented in the Bake-Off.

Troubleshooting

On some systems, installing rJava does not work out of the box. Various topics regarding this are available on stackoverflow.

On unix based systems, a simple fix that often works is to run sudo R CMD javareconf in the command line before restarting R and installing again.

Will there be a CRAN release?

Unfortunately our software requires a java binary. This binary has around 40 MB, which is to big for CRAN packages.

Contribute & Support

We appreciate bug-reports and contributions! Feel free to contact us if any questions arise!

Contribute to the software

Contributions and new ideas are welcome, feel free to open an issue or pull request on GitHub. It is advised to contact the Authors before (via Email or an Issue) in order to avoid duplicate work.

Issues or Support with the software

If you encounter errors with the software or require assistance, contact us on GitHub.

Java refactoring

The code for the .jar file underlying TSClassification can be obtained from the jTSC4R repository. We aim to track changes made by the authors of the TimeSeries Classification Bakeoff there.



compstat-lmu/TSClassification documentation built on Nov. 18, 2019, 6:56 a.m.