Skip to main content

HTTP client for the juniper-recurrence service (the Δt-native LMU recurrence model + cross-validation API)

Project description

juniper-recurrence-client

HTTP client for the juniper-recurrence service — the FastAPI app wrapping the Δt-native LMU recurrence model and its cross-validation API. A lean requests-based client mirroring juniper-data-client and juniper-cascor-client, so consumers (notably juniper-canopy's recurrence backend adapter) drive every Juniper backend the same way.

Install

pip install juniper-recurrence-client          # once published
pip install -e ".[test]"                        # local development

requests-only at the core; pip install juniper-recurrence-client[observability] adds the optional juniper-observability integration (X-Request-ID propagation + the on_request hook).

Quick start

from juniper_recurrence_client import JuniperRecurrenceClient

client = JuniperRecurrenceClient("http://localhost:8211", api_key="…")

# Train the LMU regressor on a dataset (by id / name / generator)
client.train(name="equities", d=16)

# Predict — inline X with Δt, or a dataset reference
client.predict(dataset_id="ds-1")

# Walk-forward cross-validation over the dataset's _full split
result = client.crossval(name="equities", n_folds=4, scheme="expanding", embargo=2)
print(result["eval_aggregate"])

# Inspect
client.get_model()        # topology + metrics
client.training_status()  # state + events
client.is_ready()         # readiness probe

API surface

Method Endpoint
train(*, dataset_id / name / generator, params, split, d, theta, ridge) POST /v1/train
training_status() GET /v1/training/status
predict(*, X / dt / target_dt / seq_lengths, or a dataset ref) POST /v1/predict
crossval(*, n_folds, scheme, embargo, min_train, dataset ref, d, theta, ridge) POST /v1/crossval
crossval_status() GET /v1/crossval/status
get_model() GET /v1/model
get_dataset() GET /v1/dataset
health_check() / is_ready() / wait_for_ready() GET /v1/health[/ready]

Authentication

Pass api_key=…, or set JUNIPER_RECURRENCE_API_KEY (or the Docker-secret JUNIPER_RECURRENCE_API_KEY_FILE, a path whose stripped contents are the key). The key is sent as the X-API-Key header. Note the asymmetry: the server reads the plural JUNIPER_RECURRENCE_API_KEYS (its accepted set); the client sends one key under the singular env var.

Errors

All errors derive from JuniperRecurrenceClientError: JuniperRecurrenceConnectionError, JuniperRecurrenceTimeoutError, JuniperRecurrenceNotFoundError (404), JuniperRecurrenceConflictError (409 — a run already in progress, or no trained model yet), JuniperRecurrenceValidationError (400/422), JuniperRecurrenceConfigurationError.

License

MIT — see LICENSE.

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

juniper_recurrence_client-0.1.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

juniper_recurrence_client-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for juniper_recurrence_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6500fa89dc0b518847a49f972ed047a7155a863d71fce6edcd9a517ef0414a08
MD5 6b92d6bfe15f5631d22ea405d9b4b912
BLAKE2b-256 3ab3b479e3e30ac56d4af783a8807abda880dd63137a0416e47fb8f35e736877

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_recurrence_client-0.1.0.tar.gz:

Publisher: publish-recurrence-client.yml on pcalnon/juniper-recurrence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for juniper_recurrence_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9448edb0d01940c4e98cf10d4fbc99a4f197fb69f59dd943c137521c04430283
MD5 13475b57112950b0aef07993ea274025
BLAKE2b-256 35433ba435d6d4f0ea37ed9905c53cf31a59801cee4c55653a073e061dfa07b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_recurrence_client-0.1.0-py3-none-any.whl:

Publisher: publish-recurrence-client.yml on pcalnon/juniper-recurrence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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