Skip to main content

Adaptive model lifecycle for financial signal selection and prediction

Project description

jaymd-winnow

Adaptive model lifecycle for financial signal selection and prediction.

Installation

pip install jaymd-winnow

Quick Start

import numpy as np
from jaymd_winnow import AdaptivePipeline

# Single-target regression
pipeline = AdaptivePipeline.regression(min_history=252)

# Feed data step by step
for i, (timestamp, features, target) in enumerate(your_data_stream):
    result = pipeline.step(
        timestamp=timestamp,
        features=features,
        targets=target if i > 0 else None,  # target for PREVIOUS prediction
    )

    if not result.is_warmup:
        pred = result.predictions["target"]
        print(f"Point: {pred.point}, Intervals: {pred.intervals}")

Features

  • Automatic feature clustering — reduces thousands of correlated features to independent representatives
  • Stability selection — identifies features with statistically reliable target association
  • Conformal prediction — calibrated prediction intervals (regression) and prediction sets (classification)
  • Health monitoring — PIT uniformity, Brier reliability, ECE, SHAP importance stability
  • Adaptive retraining — triggers model updates when calibration degrades or feature structure shifts
  • Regime detection — uses change-point detection to select relevant training windows
  • Multi-target support — shared feature selection, independent models per target

Model Types

  • elastic_net — ElasticNetCV (regression) / LogisticRegressionCV (classification)
  • lightgbm — LightGBM gradient boosted trees
  • ensemble — VotingRegressor/VotingClassifier combining both

API

Constructors

# Single-target
pipeline = AdaptivePipeline.regression(min_history=252)
pipeline = AdaptivePipeline.classification(min_history=500)

# Multi-target
pipeline = AdaptivePipeline.multi_target(
    targets=[
        {"name": "returns", "task": "regression"},
        {"name": "direction", "task": "binary", "model_type": "lightgbm"},
    ]
)

# Full control
from jaymd_winnow import PipelineConfig, TargetConfig, ModelConfig
config = PipelineConfig(
    targets=[TargetConfig(name="target", task="regression", model=ModelConfig(model_type="ensemble"))],
    min_history=252,
)
pipeline = AdaptivePipeline(config)

Step Loop

result = pipeline.step(timestamp, features, targets)
# result.predictions: dict[str, TargetPrediction]
# result.health: HealthSnapshot
# result.event: LifecycleEvent (retraining, etc.)
# result.is_warmup: bool

Serialisation

pipeline.save("checkpoint.joblib")
pipeline = AdaptivePipeline.load("checkpoint.joblib")

Trace Analysis

from jaymd_winnow import PipelineTrace

trace = PipelineTrace(results)
timestamps, pvalues = trace.calibration_over_time()
events = trace.events("retrain_refit")
changes = trace.feature_set_changes()

License

MIT

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

jaymd_winnow-0.1.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

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

jaymd_winnow-0.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file jaymd_winnow-0.1.0.tar.gz.

File metadata

  • Download URL: jaymd_winnow-0.1.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for jaymd_winnow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 985ef25c88da4a69b8cf6ae7bfe8baede9207a251cce5bbd788abc263c931c6d
MD5 cffef15ee55c7398e28012d5e92a11d8
BLAKE2b-256 8881b8c636e8a6caf03d9734b7bb1a7bab0dec0062a31766f0f3a5f67b63c607

See more details on using hashes here.

File details

Details for the file jaymd_winnow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jaymd_winnow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for jaymd_winnow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 625f0b0d6040795dcdd783ec4591ddf0355ef2c2b679e37df0b59705abf5b7e5
MD5 6d49e2d5294cbf3653f79fd69b92946b
BLAKE2b-256 2ad1612f423e4ea5c0f8f7d33c7b1217a9735fb9e8ae00872c9a736d3889d131

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