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.

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.1.0.tar.gz (12.9 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.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: juniper_cascor_client-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 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.1.0.tar.gz
Algorithm Hash digest
SHA256 ad597d088b1a0eacb6272444f38216bcc7fb78813e201016015f85840a1819af
MD5 9c0bf81aac3f0fba49f616f0ea9e6aeb
BLAKE2b-256 ce19f285b5a24d0b90416082c501b04c2e6b42d15e2d9908151c8c443fcb7910

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_cascor_client-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for juniper_cascor_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49141b8a1ce3138e368f164b21f34ca30c992a92246996f8ab904dd862e8a7f5
MD5 7c6d813e3391d0027678f500cd1e2fe3
BLAKE2b-256 0d82bffb3e32880f09248d0d398e14edbae7a20fa33823340d119b577a2a576a

See more details on using hashes here.

Provenance

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