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).

Port: 8211 is the juniper-recurrence service's default host port; under Docker it maps to the container's 8210 (see the app README). Point the client at whichever host:port the service is published on.

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.2.0.tar.gz (16.5 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.2.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for juniper_recurrence_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1289a26db15fe7fe6aae33133305201b0c52e95383235a6858dd70c8bda1319f
MD5 705077dc32d4b55e752bdd0697d71d3b
BLAKE2b-256 0afb67a613b3c0b792976ab993ffcd85292b72e97e82a2d6642c93cdd61c81ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_recurrence_client-0.2.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for juniper_recurrence_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83c2fe6d8213f98b45aca93b757148b11027c2229622982582824906e30f6ec0
MD5 022847e66a00ba3161976b80b80ae382
BLAKE2b-256 b88fefd974f3e8fd74d27e7d8e4099dee9f6435e510be9ff7a549c345a5f56f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_recurrence_client-0.2.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