Highly comparative time-series analysis

Overview

〰️ hctsa 〰️ : highly comparative time-series analysis

DOI Twitter

hctsa is a software package for running highly comparative time-series analysis using Matlab (full support for versions R2018b or later).

The software provides a code framework that enables the extraction of thousands of time-series features from a time series (or a time-series dataset). It also provides a range of tools for visualizing and analyzing the resulting time-series feature matrix, including:

  1. Normalizing and clustering the data,
  2. Producing low-dimensional representations of the data,
  3. Identifying and interpreting discriminating features between different classes of time series,
  4. Learning multivariate classification models.

Feel free to email me for help with real-world applications of hctsa 🤓

Acknowledgement 👍

If you use this software, please read and cite these open-access articles:

Feedback, as email, github issues or pull requests, is much appreciated.

For commercial use of hctsa, including licensing and consulting, contact Engine Analytics.

Getting Started 😊

Documentation 📖

Comprehensive documentation for hctsa, from getting started through to more advanced analyses is on gitbook.

Downloading the repository ⬇️

For users unfamiliar with git, the current version of the repository can be downloaded by simply clicking the green Code button, and then clicking Download ZIP.

It is recommended to use the repository with git. For this, please make a fork of it, clone it to your local machine, and then set an upstream remote to keep it synchronized with the main repository e.g., using the following code:

git remote add upstream git://github.com/benfulcher/hctsa.git

(make sure that you have generated an ssh key and associated it with your Github account).

You can then update to the latest stable version of the repository by pulling the master branch to your local repository:

git pull upstream master

For analyzing specific datasets, we recommend working outside of the repository so that incremental updates can be pulled from the upstream repository. Details on how to merge the latest version of the repository with the local changes in your fork can be found here.

Related resources

CompEngine 💥

CompEngine is an accompanying web resource for this project. It is a self-organizing database of time-series data that allows users to upload, explore, and compare thousands of diverse types of time-series data. This vast and growing collection of time-series data can also be downloaded. Go have a play, read more about it in our 📙 paper, or watch a talk on YouTube.

catch22 2️⃣ 2️⃣

Is over 7000 just a few too many features for your application? Do you not have access to a Matlab license? catch22 has all of your faux-rhetorical questions covered. This reduced set of 22 features, determined through a combination of classification performance and mutual redundancy as explained in this paper, is available here as an efficiently coded C implementation with wrappers for python, R, and Julia.

hctsa datasets and example workflows 💾

There are a range of open datasets with pre-computed hctsa features, as well as some examples of hctsa workflows.

(If you have data to share and host, let me know and I'll add it to this list)

Running hctsa on a cluster 💻

Matlab code for computing features for an initialized HCTSA.mat file, by distributing the computation across a large number of cluster jobs (using pbs or slurm schedulers) is here.

Publications 📕

hctsa has been used by us and others to do new science in neuroscience, engineering, and biomedicine. An updated list of publications using hctsa is on this wiki page.

hctsa licenses

Internal licenses

There are two licenses applied to the core parts of the repository:

  1. The framework for running hctsa analyses and visualizations is licensed as the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. A license for commercial use is available from Engine Analytics.

  2. Code for computing features from time-series data is licensed as GNU General Public License version 3.

A range of external code packages are provided in the Toolboxes directory of the repository, and each have their own associated license (as outlined below).

External packages and dependencies

Many features in hctsa rely on external packages and Matlab toolboxes. In the case that some of them are unavailable, hctsa can still be used, but only a reduced set of time-series features will be computed.

hctsa uses the following Matlab Add-On Toolboxes: Statistics and Machine Learning, Signal Processing, Curve Fitting, System Identification, Wavelet, and Econometrics.

The following external time-series analysis code packages are provided with the software (in the Toolboxes directory), and are used by our main feature-extraction algorithms to compute meaningful structural features from time series:

Other time-series analysis resources

A collection of good resources for time-series analysis (including in other programming languages like python and R) are on the wiki.

Acknowledgements 👋

Many thanks go to Romesh Abeysuriya for helping with the mySQL database set-up and install scripts, and Santi Villalba for lots of helpful feedback and advice on the software.

Comments
  • nn_prepare.m as a function is not supported and a whole host of other errors

    nn_prepare.m as a function is not supported and a whole host of other errors

    I am using Ethoscope velocity data to distinguish between genotype. I don't have a license for the econometrics toolbox so I get a few errors about that. Additionally I get errors about functions not being supported. Are these issue with my installation or is it because the data is not amenable to that particular analysis?

    Execution of script nn_prepare as a function is not supported:
    /home/luca/Toolboxes/OpenTSTOOL/tstoolbox/mex/nn_prepare.m
    
    opened by posttenebre 8
  • Stochasticity

    Stochasticity

    Some operations output results that depend on the random seed, and thus running the same operation on the same time series can produce different results if run multiple times. A solution to this is required, and could be done by allowing a random seed input to each non-deterministic function, to allow reproducible results. If none is provided, a default could be rng('default') at the start of each function. I should implement this as a priority going forward.

    bug 
    opened by benfulcher 6
  • TS_GetIDs returns brace indexing error

    TS_GetIDs returns brace indexing error

    Hi Ben,

    I get this error when trying to GetIds of a part of name from the Operations.Name table.

    When I leave the 'Name' flag out it searches the keywords field and it works fine.

    >> OperationIDs = TS_GetIDs('mystring', myFile, 'ops', 'Name');
    Loading data from....mat... Done.
    Brace indexing is not supported for variables of this type.
    
    Error in TS_GetIDs (line 114)
                cmatch = find(contains(theDataTable.Name,theMatchString{i}));
    

    However it works when I use 'contains' below (partially copying the method used in keywords). I'm not sure the reason for the loop in Name using cmatch?

        case {'name','Name'}
            % The cell of comma-delimited keyword strings:
            theKeywordCell = theDataTable.Name;
    
            % Find objects with a keyword that matches the input string:
            matches = find(contains(theKeywordCell, theMatchString));
    
            % Return the IDs of the matches:
            IDs = theDataTable.ID(matches);
    
            % Check for empty:
            if isempty(IDs)
                warning('No matches to ''%s'' found in %s',theMatchString,theDataFile)
            end
    
    opened by LJGz 5
  • TISEAN d2 leaves temporary files undeleted

    TISEAN d2 leaves temporary files undeleted

    opened by sdvillal 5
  • Multivariate time series analysis

    Multivariate time series analysis

    Hello,

    Thank you for such an amazing tool. I'm wondering about how to approach multivariate time series using hctsa. Is there a special way of assigning the keywords before using TS_LabelGroups?

    Thank you in advance, Konstantin

    opened by smetanadvorak 4
  • database connection error

    database connection error

    mysql_dbopen.m throws error even after including the appropriate connector via

    javaaddpath('/home/philip/work/CompEngineMatlab/Database/mysql-connector-java-5.1.34-bin.jar')
    
    % -- Error -- 
    Error using mysql_dbopen (line 24)
    Error with java database connector: Java exception occurred:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
    
    opened by Philiphorst 4
  • Not able to skip User input

    Not able to skip User input "y" in TS_Init

    Hi,

    I am trying to extract the temporal features from a large number of BOLD resting state fMRI signals using hctsa toolbox. Therefore, I have written a script which loads keyword matrices, labels, and timeseries in a loop and inputs them sequentially to TS_Init for creation of HCTSA.mat files. But, for each loop the algorithm requires a user input "y" to confirm the time series. I could not find the corresponding line of the code in "TS_Init.m" file of the toolbox to modify it and skip this step, and I was wondering if you could please guide me towards solving this issue.

    Thank you for the great toolbox. Regards, Ali

    opened by javanray 3
  • Wrong_TS_Classify

    Wrong_TS_Classify

    Hi Ben,

    I have been using your HCTSA toolbox for sometime and had a question. HCTSA is an outstanding job. When I get start with "hctsa_phenotypingWorm-master" and "hctsa_phenotypingFly-master" project. Here was the question that plotconfusion(realLabels,predictLabels); plotconfusion (line 111) update_args = standard_args(args{:}); plotconfusion>standard_args (line 255) Value is not a matrix or cell array. I did not understand how to solve this problem. Can you give me some suggestions?

    opened by ozone521 3
  • Multivariate TS classification

    Multivariate TS classification

    Dear Ben, first of all thank you for all the work and effort you put into the hctsa package. It has been really helpful so far!

    In the beginning I was dealing with a single sensor to monitor a pressure ts. The classification is mostly a 2-class but can also be a multiple class problem. Now, I have multiple sensors available that monitor one and the same process. I would like to include possible relations and dependencies between the sampled variables into my analsis. Therefore, I like to ask if you have made any experience yet on how to implement a multivariate ts analysis in a smart way, still using all the beautiful functions within this package.

    Thank you in advance and best regards, Alex

    opened by zeisal 3
  • Re: Forecasting

    Re: Forecasting

    Hi,

    I'm generating features for a forecasting application. I require "causal" features, i.e. features that at any point in time do not use future information. I noted that there is a subset of features with the keyword 'forecasting.' Are these all causal? Are any features in other subsets also causal? Is there a simple way to extract only those sorts of features?

    Thanks for any help on this matter, Gavin.

    opened by xenmind 3
  • Update TS_plot_timeseries.m

    Update TS_plot_timeseries.m

    Hi Ben, added the legend into the time series plot. The code may seem a little clunky so feel free to edit/make it a bit nicer :)

    Also went through and added further options to TS_classify so classification rates are returned, and there is the option to suppress the confusion matrix.

    Nic

    opened by nic-barbara 3
  • Error using compile_mex

    Error using compile_mex

    When I try to compile the install.m file I get this error:

    Error using compile_mex An error occurred while compiling ML_Fastdfa_core C code. It appears that mex is not set up to work on this system (cf. 'doc mex' and 'mex -setup'). Get 'mex ML_fastdfa_core.c' to work, and then re-run compile_mex.m

    In the code warns you of this but I do not know how to configure it 'Please make sure that mex is set up with the right compilers for this system.'

    opened by Carlosrrn 1
  • compile_mex error from range_search.cpp file

    compile_mex error from range_search.cpp file

    Hi Ben,

    I have encountered an error when compiling MEX as part of the installation process. When compiling the OpenTSTOOL, I get a series of warnings followed by an error. This is generated from the range_search.cpp file line 116 (see screenshot below): Screenshot 2022-09-19 at 10 52 11

    I suspect that the error arises as the code is trying to compare a range to an integer, which is an invalid operation? When justifying that part of the code, the MEX is compiled successfully (see screenshot below): Screenshot 2022-09-19 at 10 52 53

    I just wanted to share this and I would be grateful for any suggestions. FYI - I am using macOS Catalina v10.15.7 and Matlab R2021a.

    Many thanks! Irene

    opened by faimai00 1
  • TS_Classify produces an

    TS_Classify produces an "Unrecognized function or variable 'foldLosses'" error when trying to save the classifier

    Hi Ben

    I'm just trying to save the classifier produced by TS_Classify, and I'm getting an error saying both Unrecognized function or variable 'foldLosses', and Unrecognized function or variable 'whatLoss'. It looks like these variables are no longer produced by TS_Classify (when I use the find function to look for the variables within TS_Classify, they are not produced as outputs on any line). When I comment out the lines that require these variables, the function works.

    It looks like the aspect of the TS_Classify function that utilizes these variables might have been removed at some stage, because I've noticed the following in the output description (I was also interested in the doPCs option, but couldn't work out how to perform it):

    %---OUTPUTS: % Text output on classification rate using all features, and if doPCs = true, also % shows how this varies as a function of reduced PCs (text and as an output plot) % foldLosses, the performance metric across repeats of cross-validation % nullStats, the performance metric across randomizations of the data labels % jointClassifier, details of the saved all-features classifier

    Kind regards,

    Neil

    opened by NeilwBailey 1
  • Consider a cloud CI service

    Consider a cloud CI service

    Given public open source projects have free support for cloud ci services, consider leveraging one of them here. 🎉

    https://blogs.mathworks.com/developer/2020/12/15/cloud-ci-services/

    opened by acampbel 1
  • Analysis methods mistreat missing values

    Analysis methods mistreat missing values

    Analysis methods, like TS_TopFeatures, assume that there are no errors in the data matrix (i.e., that all bad values have been filtered out of the dataset, using TS_normalize). There should be better checks on this, to avoid the zeros in TS_DataMat being treated as actual zeros (rather than error symbols in TS_Quality. Best solution would be to use data in TS_Quality to restrict the computation to good values (where meaningful analysis is possible), e.g., in the case of TS_TopFeatures.

    bug 
    opened by benfulcher 0
  • Operations -> Features

    Operations -> Features

    Perhaps it's time to update the terminology, since Feature is more common usage than Operation. Could consider changing the name of the Operations data object to Features...

    opened by benfulcher 0
Releases(v1.07)
  • v1.07(Jul 22, 2022)

    • TS_SimSearch supports interactive plots to swap between raw and ranked values in scatter plots
    • Better error messaging for computation
    • install script checks for required toolboxes
    • 'svmBeta' option to score individual features on SVM beta weights: added to TS_TopFeatures
    • Better checks on input data type (e.g., singles or integers) in feature computation
    • Improved reporting of in-fold and out-of-fold accuracies in k-fold CV classification
    • Logistic regression added to classifiers, as well as svm-linear (high-dim) default (original available as svm-linear-lowdim)
    • TS_ClassifyLowDim expanded functionality to check for in-sample over-fitting
    • Null testing improved with option for simple shuffle-based nulls (under assumption that random in -> random out; rather than full model-based nulls)
    • Improved visualization settings in TS_TopFeatures (including Spearman correlations now default)
    • signed p-value test statistic from rank-sum test added in TS_TopFeatures
    • Improved syntax for TS_Init for selecting a feature set by name.
    • Progress bar option for new minimal output versions of TS_Compute as 'fast' and 'minimal' (in cases like with catch22 where full output makes the commandline unreadable.
    • Some feature keywords improved.
    Source code(tar.gz)
    Source code(zip)
  • v1.06(Aug 5, 2021)

    • Interactive plotting (annotations added in response to mouse clicks) in TS_LowDimInspect and TS_FeatureSummary
    • Histogram binning now done in a simpler and more transparent way, to match C implementation in catch22 (in DN_HistogramMode).
    • New histogram asymmetry features added via DN_HistogramAsymmetry.
    Source code(tar.gz)
    Source code(zip)
  • v1.05(Jan 8, 2021)

    • Clearer naming of the CO_HistogramAMI features
    • New nsadf feature
    • New features of first maximum of various self-correlation function (rather than just first min) added.
    • Various additional fixes
    Source code(tar.gz)
    Source code(zip)
  • v1.04(Jul 22, 2020)

    • Clearer naming of CO_HistogramAMI features
    • Ability to specify reduced feature subsets in cfnParams (that will be applied in TS_Classify, TS_ClassifyLowDim, TS_TopFeatures, TS_PlotLowDim)
    • Clearer keyword labeling of 'locDep' -> 'locationDependent', etc.
    Source code(tar.gz)
    Source code(zip)
  • v1.03(Jul 2, 2020)

    Added continuous analogues of first crossings

    CO_FirstZero and CO_f1ecac combined into CO_FirstCrossing, and added discrete (first time lag the ACF exceeds the threshold) and continuous (linear interpolation for the crossing estimate, between previous and subsequent time points). Also an issue with BF_PreProcess consistency and with 'absclose' being incorrectly set to 'saturate' causing an issue for DN_RemovePoints

    Source code(tar.gz)
    Source code(zip)
  • v1.02(May 17, 2020)

  • v1.01(May 16, 2020)

  • v1.0(Jul 11, 2019)

    Tweaked some features, fixed some errors. Semantic versioning practices are not quite valid for hctsa's feature library (where every slight change to any feature makes hctsa results inconsistent with every previous version). But it's about time we had a v1.0!

    Source code(tar.gz)
    Source code(zip)
  • v0.99(Feb 15, 2019)

    Cleaning of poor-performing features, FourierPowerSpectrum keyword used, TS_plot_timeseries -> TS_PlotTimeSeries for consistent naming convention, improvement in Gaussian mutual information computation.

    Source code(tar.gz)
    Source code(zip)
  • 0.98(Sep 3, 2018)

    • Metadata for TimeSeries, Operations, and MasterOperations are now stored in tables (rather than clunkier cell arrays).
    • TS_plot_pca renamed TS_PlotLowDim and now supports tSNE projections.
    • Added very simple function for reducing the number of features as TS_ReduceFeatureSet.
    Source code(tar.gz)
    Source code(zip)
  • v0.96(Mar 5, 2018)

  • v0.92(Mar 5, 2018)

Owner
Ben Fulcher
I use methods from physics and statistics to understand the structure and dynamics of complex systems like the brain
Ben Fulcher
The first public PyTorch implementation of Attentive Recurrent Comparators

arc-pytorch PyTorch implementation of Attentive Recurrent Comparators by Shyam et al. A blog explaining Attentive Recurrent Comparators Visualizing At

Sanyam Agarwal 150 Oct 14, 2022
ICNet and PSPNet-50 in Tensorflow for real-time semantic segmentation

Real-Time Semantic Segmentation in TensorFlow Perform pixel-wise semantic segmentation on high-resolution images in real-time with Image Cascade Netwo

Oles Andrienko 219 Nov 21, 2022
Using python and scikit-learn to make stock predictions

MachineLearningStocks in python: a starter project and guide EDIT as of Feb 2021: MachineLearningStocks is no longer actively maintained MachineLearni

Robert Martin 1.3k Dec 29, 2022
[NeurIPS 2020] Code for the paper "Balanced Meta-Softmax for Long-Tailed Visual Recognition"

Balanced Meta-Softmax Code for the paper Balanced Meta-Softmax for Long-Tailed Visual Recognition Jiawei Ren, Cunjun Yu, Shunan Sheng, Xiao Ma, Haiyu

Jiawei Ren 65 Dec 21, 2022
Hough Transform and Hough Line Transform Using OpenCV

Hough transform is a feature extraction method for detecting simple shapes such as circles, lines, etc in an image. Hough Transform and Hough Line Transform is implemented in OpenCV with two methods;

Happy N. Monday 3 Feb 15, 2022
YOLOv3 in PyTorch > ONNX > CoreML > TFLite

This repository represents Ultralytics open-source research into future object detection methods, and incorporates lessons learned and best practices

Ultralytics 9.3k Jan 07, 2023
RaftMLP: How Much Can Be Done Without Attention and with Less Spatial Locality?

RaftMLP RaftMLP: How Much Can Be Done Without Attention and with Less Spatial Locality? By Yuki Tatsunami and Masato Taki (Rikkyo University) [arxiv]

Okojo 20 Aug 31, 2022
Sequence modeling benchmarks and temporal convolutional networks

Sequence Modeling Benchmarks and Temporal Convolutional Networks (TCN) This repository contains the experiments done in the work An Empirical Evaluati

CMU Locus Lab 3.5k Jan 01, 2023
Official implementation for paper: Feature-Style Encoder for Style-Based GAN Inversion

Feature-Style Encoder for Style-Based GAN Inversion Official implementation for paper: Feature-Style Encoder for Style-Based GAN Inversion. Code will

InterDigital 63 Jan 03, 2023
Machine learning library for fast and efficient Gaussian mixture models

This repository contains code which implements the Stochastic Gaussian Mixture Model (S-GMM) for event-based datasets Dependencies CMake Premake4 Blaz

Omar Oubari 1 Dec 19, 2022
Code for BMVC2021 "MOS: A Low Latency and Lightweight Framework for Face Detection, Landmark Localization, and Head Pose Estimation"

MOS-Multi-Task-Face-Detect Introduction This repo is the official implementation of "MOS: A Low Latency and Lightweight Framework for Face Detection,

104 Dec 08, 2022
Winners of DrivenData's Overhead Geopose Challenge

Winners of DrivenData's Overhead Geopose Challenge

DrivenData 22 Aug 04, 2022
Regulatory Instruments for Fair Personalized Pricing.

Fair pricing Source code for WWW 2022 paper Regulatory Instruments for Fair Personalized Pricing. Installation Requirements Linux with Python = 3.6 p

Renzhe Xu 6 Oct 26, 2022
Adversarial Learning for Semi-supervised Semantic Segmentation, BMVC 2018

Adversarial Learning for Semi-supervised Semantic Segmentation This repo is the pytorch implementation of the following paper: Adversarial Learning fo

Wayne Hung 464 Dec 19, 2022
CVPR '21: In the light of feature distributions: Moment matching for Neural Style Transfer

In the light of feature distributions: Moment matching for Neural Style Transfer (CVPR 2021) This repository provides code to recreate results present

Nikolai Kalischek 49 Oct 13, 2022
Accuracy Aligned. Concise Implementation of Swin Transformer

Accuracy Aligned. Concise Implementation of Swin Transformer This repository contains the implementation of Swin Transformer, and the training codes o

FengWang 77 Dec 16, 2022
Repository for "Toward Practical Monocular Indoor Depth Estimation" (CVPR 2022)

Toward Practical Monocular Indoor Depth Estimation Cho-Ying Wu, Jialiang Wang, Michael Hall, Ulrich Neumann, Shuochen Su [arXiv] [project site] DistDe

Meta Research 122 Dec 13, 2022
This project hosts the code for implementing the ISAL algorithm for object detection and image classification

Influence Selection for Active Learning (ISAL) This project hosts the code for implementing the ISAL algorithm for object detection and image classifi

25 Sep 11, 2022
Accelerate Neural Net Training by Progressively Freezing Layers

FreezeOut A simple technique to accelerate neural net training by progressively freezing layers. This repository contains code for the extended abstra

Andy Brock 203 Jun 19, 2022
Dataset for the Research2Clinics @ NeurIPS 2021 Paper: What Do You See in this Patient? Behavioral Testing of Clinical NLP Models

Behavioral Testing of Clinical NLP Models This repository contains code for testing the behavior of clinical prediction models based on patient letter

Betty van Aken 2 Sep 20, 2022