Skip to main content

A modular library for benchmarking sequential decision-making models in temporal environments.

Project description

TSDM — Time Series Decision-Making Benchmark (Alpha)

TSDM is a lightweight benchmarking framework for evaluating agents in sequential decision-making tasks based on temporal data.

It provides a clean, Gym-free setup with controlled environments and standardized agents — ideal for systematic experimentation in time-series-only decision-making.


📝 Overview

TSDM focuses on agents that observe a single temporal value at each step and must sequentially decide on a binary action (betting up or down).
Performance is tracked through cumulative rewards based on correct or incorrect predictions.


📦 Installation

From PyPI (Recommended)

pip install tsdm-benchmark

📦 Current Components

✅ Core Agent Classes (agents.py)

  • Abstract Base Class

    • Agent — defines the interface for all agents (observe(), place_bet(), reset())
  • Baseline Heuristic Agents

    • AlwaysUpAgent — Always predicts "up"
    • RepeatLastMovementAgent — Predicts based on last movement direction
    • FrequencyBasedMajorityAgent — Predicts based on majority of past movement directions
  • Statistical Agents

    • StaticMeanReversionAgent — Bets on reversion to historical mean
    • DynamicMeanReversionAgent — Bets on mean reversion within a rolling time window
  • Learning Agents

    • SGDClassifierAgent — Online learning using scikit-learn’s SGDClassifier
    • DQNAgent — Deep Q-Learning agent with experience replay (PyTorch-based)

✅ Sequential Betting Game (games.py)

  • Simulates a sequential game between a time series generator and an agent
  • Handles:
    • Time series generation (requires a generator with .generate_value())
    • Agent action sampling via .place_bet()
    • Reward assignment (+1 correct / -1 incorrect)
    • Step logging and cumulative reward tracking

🎲 Example Usage

from tsdm.agents import AlwaysUpAgent
from tsdm.betting_game import BettingGame
from tsg.generators import LinearTrendGenerator  # Assuming you have tsg-lib

agent = AlwaysUpAgent()
generator = LinearTrendGenerator(slope=0.1)
game = BettingGame(generator=generator, observer=agent, total_movements=1000)

final_reward = game.play_game()
print(f"Final cumulative reward: {final_reward}")

Acknowledgments

Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or European Research Executive Agency (REA). Neither the European Union nor the granting authority can be held responsible for them.

EU Logo

License

MIT — see 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

tsdm_benchmark-0.2.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

tsdm_benchmark-0.2.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file tsdm_benchmark-0.2.1.tar.gz.

File metadata

  • Download URL: tsdm_benchmark-0.2.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for tsdm_benchmark-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3b6a9ec2b395d28a4f4cd9d0b4ca69580848b5ae8d8f3e8aee8e2c511a4e1d83
MD5 592c8014862989251ca4a4a1f0f0fdfd
BLAKE2b-256 156c2f8a665360047a5fe4004708c94bbb4a7c81ad9969afe505d74611240739

See more details on using hashes here.

File details

Details for the file tsdm_benchmark-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: tsdm_benchmark-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for tsdm_benchmark-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c14503a10efc92b7faae4a89fbd8c896ced16650e8605cf1fff0f3a40f2cfa1
MD5 46a6490fbca0ee594f622bfe65c0fece
BLAKE2b-256 d23e2d65604d3436269f42f704639d500d3f10e6e7d8c774a3b45bd8ed113441

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