Skip to main content

HTTP/WebSocket client for the JuniperCascor neural network training service

Project description

juniper-cascor-client

Python HTTP/WebSocket client for the JuniperCascor cascade correlation neural network training service.

Ecosystem Compatibility

This package is part of the Juniper ecosystem. Compatible with:

juniper-data juniper-cascor juniper-canopy
0.4.x 0.3.x 0.2.x

Installation

pip install juniper-cascor-client

Usage

REST Client

from juniper_cascor_client import JuniperCascorClient

with JuniperCascorClient("http://localhost:8200") as client:
    # Create a network
    client.create_network(input_size=2, output_size=2, learning_rate=0.01)

    # Start training
    client.start_training(
        dataset={"source": "inline"},
        inline_data={
            "train_x": [[0, 0], [1, 0], [0, 1], [1, 1]],
            "train_y": [[1, 0], [0, 1], [0, 1], [1, 0]],
        },
        epochs=100,
    )

    # Check status
    status = client.get_training_status()
    print(status["data"]["training_active"])

    # Get metrics
    metrics = client.get_metrics()
    print(f"Loss: {metrics['data']['train_loss']}")

WebSocket Training Stream

import asyncio
from juniper_cascor_client import CascorTrainingStream

async def monitor():
    async with CascorTrainingStream("ws://localhost:8200") as stream:
        async for message in stream:
            if message["type"] == "metrics":
                print(f"Epoch {message['data']['epoch']}: loss={message['data']['train_loss']}")
            elif message["type"] == "cascade_add":
                print(f"New hidden unit added!")

asyncio.run(monitor())

WebSocket Control

import asyncio
from juniper_cascor_client import CascorControlStream

async def control():
    async with CascorControlStream("ws://localhost:8200") as ctrl:
        result = await ctrl.command("start", {"epochs": 200})
        print(result)

asyncio.run(control())

API Reference

JuniperCascorClient

Method Description
health_check() Service health check
is_alive() Liveness probe
is_ready() Readiness probe
wait_for_ready(timeout) Wait for service readiness
create_network(**kwargs) Create a CasCor network
get_network() Get network state
delete_network() Destroy network
get_topology() Network topology for visualization
get_statistics() Network weight statistics
start_training(...) Start async training
stop_training() Stop training
pause_training() Pause training
resume_training() Resume training
reset_training() Reset state
get_training_status() Current training status
get_training_params() Training parameters
get_metrics() Current metrics
get_metrics_history(count) Metrics history
get_dataset() Dataset metadata
get_decision_boundary(resolution) Decision boundary grid

CascorTrainingStream

Async WebSocket client for /ws/training. Supports async iteration and callbacks.

CascorControlStream

Async WebSocket client for /ws/control. Send commands and receive responses.

Juniper Ecosystem

This package is part of the Juniper Cascade Correlation Neural Network Research Platform.

Package Description Install
juniper-data-client Dataset service client pip install juniper-data-client
juniper-cascor-client Neural network service client (this package) pip install juniper-cascor-client
juniper-cascor-worker Distributed training worker pip install juniper-cascor-worker

License

MIT License - see LICENSE for details.

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_cascor_client-0.2.0.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

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

juniper_cascor_client-0.2.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: juniper_cascor_client-0.2.0.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for juniper_cascor_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15f746ed62e44ba74984086a27a76b223342a12433faace956b5184c6f187c3c
MD5 6f30abab9d0517885c6b26e18c8a74ff
BLAKE2b-256 b4cc1890949a1d6e3b5e0b64a6db95e04e6a92cc67cfb0451762880e123b5b16

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_cascor_client-0.2.0.tar.gz:

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

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_cascor_client-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for juniper_cascor_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2e7d93820946db6b86cccdbd11969164a53d60586455f35395f30c6b7efaf9b
MD5 80bb9102e9d41b6bacb5c95bac24108b
BLAKE2b-256 474cca2b9137c9da08553318e4fdcaa4755b61b4fe956dd1177d5419aa90f8fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_cascor_client-0.2.0-py3-none-any.whl:

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

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