Skip to main content

MRTSBoosting: Multivariate Robust Time Series Boosting

Project description

🌾 MRTSBoosting: Multivariate Robust Time Series Boosting

MRTS-Boosting is a fast, noise-resistant, and highly flexible time series classification (TSC) framework designed to handle multivariate, irregular, and unequal-length satellite time series. It combines global (full-series) and local (interval-based) weighted features with an XGBoost classifier, enabling robust performance under difficult conditions such as:

  • cloud-contaminated optical observations,
  • temporally misaligned radar vs optical acquisition dates,
  • irregular sampling, missing values, and varying quality scores,
  • asynchronous crop growth phases or planting dates.

Originally designed for rice-field mapping using multisensor satellite vegetation indices, the framework is general and can be applied to any multivariate time-series classification task.

🔑 Key Features

  • Multivariate support with unequal length and misaligned timestamps (e.g., Sentinel-2 optical vs Sentinel-1 radar time series).
  • Quality-aware processing (e.g., CloudScore+ computed from STMS reconstruction or other quality metrics).
  • Full-series global features: weighted slope / trend, dominant period + spectral power (Lomb–Scargle), weighted entropy, weighted autocorrelation (lag-1).
  • Local interval-based features (adaptive interval selection): weighted median, Q1, Q3, weighted IQR, weighted MAD, local weighted slope. Intervals chosen based on quality weights to avoid cloudy / noisy segments.
  • Fast & scalable.
  • Flexible input formats: direct conversion from nested time series format to the required input dictionary.
  • Powered by XGBoost, enabling: strong performance on noisy data, multiclass classification, powerful built-in regularization.

📦 Installation

pip install mrtsboosting

🚀 Quick Start Example (UCR / sktime)

This example demonstrates how to train MRTSBoosting on a standard UCR dataset using nested DataFrame → dict conversion, which your class already supports.

import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import accuracy_score, cohen_kappa_score
from sktime.datasets import load_UCR_UEA_dataset

from mrtsboosting import MRTSBoostingClassifier

# 1) Load UCR dataset (nested DataFrame)
X_train, y_train = load_UCR_UEA_dataset("CBF", split="train", return_X_y=True)
X_test,  y_test  = load_UCR_UEA_dataset("CBF", split="test",  return_X_y=True)

# Encode to 0-indexed labels
le = LabelEncoder()
y_train = le.fit_transform(y_train)
y_test  = le.transform(y_test)

# 2) Convert nested sktime → flat dict format
model = MRTSBoostingClassifier(n_jobs=-1)
x_train_flat, y_train_dict = model.from_sktime_nested_uni(X_train, y_train, id_prefix='train')
x_test_flat,  y_test_dict  = model.from_sktime_nested_uni(X_test,  y_test, id_prefix='test')

# 3) Group by sample ID (required by extractor)
x_train = model.preprocess_x_data_dict(x_train_flat)
x_test  = model.preprocess_x_data_dict(x_test_flat)

# 4) Fit and predict
model.fit(x_train, y_train_dict)
y_pred = model.predict(x_test)

# 5) Evaluate
acc = accuracy_score(y_test_dict["label"], y_pred)
kappa = cohen_kappa_score(y_test_dict["label"], y_pred)

print(f"[CBF] Accuracy: {acc:.3f} | Cohen’s κ: {kappa:.3f}")

🌱 Example Workflow with Satellite Vegetation Indices (NDVI, VH, NDRE, etc.)

MRTSBoosting accepts multivariate inputs as:

x_data_dict = {
  "NDVI": {
      "sample_1": {"time": [...], "value": [...], "weight": [...]},
      "sample_2": {...},
      ...
  },
  "VH": {
      "sample_1": {...},
      ...
  }
}

y_data_dict = {
  "id": ["sample_1", "sample_2", ...],
  "label": ["rice", "non_rice", ...]
}

Example usage:

model = MRTSBoostingClassifier(
    random_state=123,
    n_jobs=-1
)

model.fit(x_data_dict, y_data_dict)
predicted_labels = model.predict(x_data_dict)

📜 License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mrtsboosting-0.1.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mrtsboosting-0.1.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file mrtsboosting-0.1.1.tar.gz.

File metadata

  • Download URL: mrtsboosting-0.1.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for mrtsboosting-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a67157fa0dd5e62ed0ad7082cc0fd3a31886a6d7bdcdc5f7dd613dda78da4273
MD5 1feb60012681b22665239dd2f04d8fd2
BLAKE2b-256 cc5aa12a415bd639fee9dfa1f92570f89e091a000db68748f18cbc54a9452189

See more details on using hashes here.

File details

Details for the file mrtsboosting-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mrtsboosting-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for mrtsboosting-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb0e706721744a0b3300ce8648b77c5b0243fa1e603f4ba6a66f16d7f9fad08
MD5 5d3cf3fb9497ce6ec7c4a5b4ef2f7668
BLAKE2b-256 2c7389590f42b8db68c7160e2c41313df7366016339a82c2116d20d0e9f3cbca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page