Skip to main content

TSelect

Installation

Option 1: Pip install

TSelect can be installed with pip.

pip install tselect

Option 2: Clone repository

Alternatively, the repository can be cloned with:

git clone https://github.com/ML-KULeuven/TSelect.git

Afterward, the requirements should be installed:

pip install -r requirements.txt

Known issues

On Windows, the installation of the pycatch22 package can fail. Installing the package with the following command usually fixes this.

pip install pycatch22==0.4.2 --use-deprecated=legacy-resolver

Quick start

TSelect is a package for selecting relevant and non-redundant channels from multivariate time series data (n instances, t timepoints, d channels). It accepts the following data formats as input:

  • MultiIndex Pandas DataFrame (with index levels: (n, t) and d columns)
  • 3D NumPy array (with shape: (n, d, t))
  • a Dictionary with TSFuse Collection objects (see https://github.com/arnedb/tsfuse for more information)

The general set-up is as follows:

from tselect.channel_selectors.tselect import TSelect

# Load your data, split in train and test set, etc.
x_train, x_test = ... 
y_train, y_test = ...

channel_selector = TSelect(irrelevant_percentage_to_keep=0.6,
                           redundant_correlation_threshold=0.7)
channel_selector.fit(x_train, y_train)
x_train_selected = channel_selector.transform(x_train)
x_test_selected = channel_selector.transform(x_test)

clf = <some MTSC classifier> # Can be any classifier for multivariate time series classification
clf.fit(x_train_selected, y_train)
y_pred = clf.predict(x_test_selected)

Hyperparameters

TSelect has several hyperparameters that can be adapted to the specific dataset and use case.

The hyperparameters to configure the irrelevant channel selector:

  • irrelevant_selector: bool, default=True
    • Whether to use the irrelevant channel selector.
  • irrelevant_percentage_to_keep: float, default=0.6
    • The percentage of channels that are expected to be relevant. TSelect will keep this percentage of channels after the irrelevant channel selector step.
    • A value between 0 and 1, where 1 means all channels are kept.
  • irrelevant_hard_threshold: float, default=0.5
    • All channels with an evaluation metric (e.g. ROCAUC) below this threshold are considered worse than random and are removed, unless this would remove all channels.

The hyperparameters to configure the redundant channel selector:

  • redundant_selector: bool, default=True
    • Whether to use the redundant channel selector.
  • redundant_correlation_threshold: float, default=0.7
    • The correlation threshold to use for the redundant channel selector step. Channels that make predictions with a correlation higher than this threshold are considered redundant.
    • A value between 0 and 1, where 1 means that the predictions have to be identical.

Other hyperparameters:

  • validation_size: float, default=None
    • The size of the validation set used to compute the evaluation metric. If None, the validation size is derived from max(100, 0.25*nb_instances). The train set then includes the remaining instances.
  • random_state: int, default=0
    • The random state to use for reproducibility.

Metadata

Release files for tselect 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tselect 1.0.0
File Size Uploaded
tselect-1.0.0.tar.gz 67.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tselect 1.0.0
File Interpreter ABI Platform
tselect-1.0.0-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details

Total release size: 155.3 kB

Release files / tselect-1.0.0.tar.gz

Download URL tselect-1.0.0.tar.gz
Size 67.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d256acd6f142d618dc5b2c16bbfcd7e0e855349bd36e60bbf708adf8519e4dea
BLAKE2b-256 checksum
How to use checksums
c46dc33eea36be4c20d092180f06540707c667468678f5cc2ce6371f1458eb86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.10 Linux/6.8.0-84-generic

Release files / tselect-1.0.0-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL tselect-1.0.0-cp312-cp312-manylinux_2_39_x86_64.whl
Size 87.6 kB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
d1407ccc3949cd62c70b143f6b02187f3dd444549a8dacd5f8d8c9540e2e27fa
BLAKE2b-256 checksum
How to use checksums
2c99c70d05d00fa38d1db3a6647d04365bb1536d15b0d1d59bb5851be70edd8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.10 Linux/6.8.0-84-generic

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page