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.2.tar.gz (39.0 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.2-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jaymd_winnow-0.1.2.tar.gz
  • Upload date:
  • Size: 39.0 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.2.tar.gz
Algorithm Hash digest
SHA256 6c723e27584bf732864b315b8a97c797adc816d3fc65a53036386b021e4b51c0
MD5 a1425a2680f3df2ca14a7b5bfba9ee97
BLAKE2b-256 04791247cca40e43cbc02773221574bd5bb4b34c9351f1c2f401e561ec6fe1c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jaymd_winnow-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c043460fc648bc27820456905b90ac9af895d0f3bbeac86b1323d225ca516f98
MD5 ded7a885d91ad9f1e6f620485780e094
BLAKE2b-256 d5ab33b5ee4f4196b0efe6d2be150c9ec52918638dc642a306a68f73783ae40f

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