System Documentation

What problem does it solve?

This Skill solves the difficulty of implementing a batched, high-performance Markov Regime-Switching (MRS) model in PyTorch while keeping parameters mathematically valid and training numerically stable.

Core Features & Use Cases

  • Batched Hamilton Filter in PyTorch: Computes negative log-likelihood and filtered regime probabilities across many independent time series using tensor operations (e.g., batched matrix multiplications).
  • Constraint-safe parameterization: Enforces strictly positive variances via exponential transforms and stochastic transition matrices via softmax parameterization so gradients remain valid.
  • Identifiability via regime sorting: Applies post-training regime permutation by descending state means to resolve label-switching, enabling consistent Bull/Neutral/Bear interpretation.
  • Numerical stability guardrails: Uses float64 guidance, epsilon padding, and log-likelihood safeguards to reduce underflow/overflow during likelihood updates.

Quick Start

Use the pytorch_hamiliton skill to implement a vectorized Hamilton filter MRS model for T time steps, N parallel asset series, and K regimes, then train it with gradient-based optimization using constrained parameters.

Dependency Matrix

Required Modules

None required

Components

assets

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: pytorch_hamiliton
Download link: https://github.com/ulf1/trading-regime/archive/main.zip#pytorch-hamiliton

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.