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.1.tar.gz (36.7 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.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jaymd_winnow-0.1.1.tar.gz
  • Upload date:
  • Size: 36.7 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.1.tar.gz
Algorithm Hash digest
SHA256 db4ed2f9b9c6324aa6bb40c24e5a809794b99feef26eddc3fbcafc2444b93ec0
MD5 f7ac19b35e88dd56d3d53e9e1b897397
BLAKE2b-256 84682c67602f292a668ae0f92df93ba756b2df4bba67d3e954d0d3e32f68693c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jaymd_winnow-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb47243d599dc38993e7c17e2b3e02253c6cc5d5ee25d7bd9c40ca4ef524a4bd
MD5 11656d105ec2ff4575d86b5b7fae4997
BLAKE2b-256 f43a720badb1063a9757ba37fbd421059de0f4f3e0944d44bfd33503854b00c9

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