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.3.tar.gz (41.5 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.3-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jaymd_winnow-0.1.3.tar.gz
  • Upload date:
  • Size: 41.5 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.3.tar.gz
Algorithm Hash digest
SHA256 902ab5c269f17f396c5d0e9ee2deb3fcbc081896f399e2184a3958db26534df9
MD5 622b8a1349b03881dcca0d4bf750cc04
BLAKE2b-256 0903d36d523cef2970bfdcfcec92d8cfd54c4b850ac0303e66361afb0258d334

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jaymd_winnow-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bfd990da39119f9566bf57b71a7ec0895d325aab5a24c802c25f583782cb2d44
MD5 63d327885ab4fba65c751233dcc5ab1b
BLAKE2b-256 90263a771e2d6c1aa72c20c9a8f1ccc2e5ce6925366306e4acbc945592af7232

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