Skip to main content

EOG-HPO Client SDK for intelligent hyperparameter recommendations

Project description

EOG-HPO Client SDK

The official Python client for the EOG-HPO Hyperparameter Optimization Cloud Service.

Installation

pip install eaheog

For visualization support:

pip install eaheog[viz]

Quick Start

from eaheog import EOGHPOClient

# Initialize client with your API endpoint
client = EOGHPOClient(base_url="https://your-api-gateway-url.amazonaws.com/prod")

# Authenticate
client.login()

# Define your objective function (runs on YOUR machine)
def train_model(config):
    # Your training code here
    lr = config['learning_rate']
    batch_size = int(config['batch_size'])
    
    # Train and evaluate
    score = your_training_function(lr, batch_size)
    return score

# Define search space
search_space = {
    'learning_rate': (0.0001, 0.1),
    'batch_size': (16, 256),
    'dropout': (0.0, 0.5)
}

# Run optimization
best = client.optimize(
    objective_function=train_model,
    search_space=search_space,
    n_iterations=50
)

print(f"Best config: {best['config']}")
print(f"Best score: {best['score']}")

Configuration

Method 1: Environment Variables (Recommended)

export EOGHPO_BASE_URL="https://your-api-gateway.amazonaws.com/prod"
export EOGHPO_API_KEY="your-api-key"  # Optional: set after login

Method 2: Initialize with Parameters

client = EOGHPOClient(
    base_url="https://your-api-gateway.amazonaws.com/prod",
    api_key="your-api-key"  # Optional
)

Method 3: Configuration File

The SDK automatically saves credentials to ~/.eaheog/credentials.json after login.

Features

  • โœ… Cloud-based Bayesian Optimization - Smart hyperparameter recommendations
  • ๐Ÿ’ฐ Cost Estimation - Know costs before running
  • ๐Ÿ“Š Live Visualization - Real-time progress tracking (with [viz] install)
  • ๐Ÿ” Secure Authentication - Token-based auth with local credential storage
  • ๐Ÿ”„ Session Management - Resume interrupted optimization runs
  • ๐Ÿ“ Export Results - Save optimization history to CSV

Authentication

Sign Up

client = EOGHPOClient(base_url="https://your-api-endpoint.com")
client.signup()

Login

client.login()  # Interactive login

Logout

client.logout()  # Clear stored credentials

Advanced Usage

Pricing calculator

# pricing.html gives current EAH set pricing tier which users should take into while planning HPO run budget.
client.open_pricing_calculator() 

Cost Estimation

# Estimate costs before starting
estimate = client.estimate_cost(
    n_iterations=100,
    search_space=search_space
)
print(f"Estimated cost: ${estimate['estimated_cost']}")

Session Management

# Start a session
session_id = client.start_optimization(
    search_space=search_space,
    n_iterations=100
)

# Resume later
client.session_id = session_id
status = client.get_session_status()

Export Results

# Export optimization history
client.export_results("my_results.csv")

Web Dashboard

# View progress in browser
client.get_web_dashboard_url()

Requirements

  • Python >= 3.7
  • requests >= 2.25.0

Optional (for visualization):

  • pandas >= 1.3.0
  • numpy >= 1.21.0
  • matplotlib >= 3.4.0
  • ipython >= 7.0.0

API Endpoints

The client expects your AWS API Gateway to expose these endpoints:

  • POST /auth/signup - User registration
  • POST /auth/login - Authentication
  • POST /estimate - Cost estimation
  • POST /start - Start optimization session
  • POST /job/{session_id}/next - Get next configuration
  • POST /job/{session_id}/result - Report result
  • GET /job/{session_id}/status - Get session status

Architecture

User's Machine                     AWS Cloud
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 โ”‚               โ”‚                  โ”‚
โ”‚  Your Training  โ”‚               โ”‚  API Gateway     โ”‚
โ”‚     Code        โ”‚               โ”‚                  โ”‚
โ”‚                 โ”‚               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                        โ”‚
         โ”‚                                 โ”‚
         โ”‚  EOGHPOClient                   โ”‚
         โ”‚  โ€ข Get config                   โ–ผ
         โ”‚  โ€ข Train locally         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚  โ€ข Report result         โ”‚   Lambda     โ”‚
         โ”‚                          โ”‚  Functions   โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค              โ”‚
                                    โ”‚ โ€ข auth_brokerโ”‚
                                    โ”‚ โ€ข optimizer  โ”‚
                                    โ”‚ โ€ข payments   โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                           โ”‚
                                           โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚  Firestore   โ”‚
                                    โ”‚   Database   โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Security

  • API keys are stored locally in ~/.eaheog/credentials.json with restricted permissions (600)
  • All API calls use HTTPS
  • Bearer token authentication
  • Credentials are never sent to third parties

Troubleshooting

Connection Errors

# Verify your base URL is correct
#client = EOGHPOClient(base_url="https://your-api-gateway.amazonaws.com/prod")

# Test connection
try:
    client.login()
except ConnectionError as e:
    print(f"Cannot connect: {e}")
    print("Verify your API Gateway URL is correct")

Authentication Issues

# Clear stored credentials and re-login
client.logout()
client.login()

Timeout Errors

# Increase timeout (default: 30s)
client.timeout = 60

Support

License

MIT License - see LICENSE file 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

eaheog-0.2.16.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

eaheog-0.2.16-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file eaheog-0.2.16.tar.gz.

File metadata

  • Download URL: eaheog-0.2.16.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for eaheog-0.2.16.tar.gz
Algorithm Hash digest
SHA256 a286f5389526585fb6805fa4d5abe16f95ec8dcf77d34e3bdd8eeb1fdd397223
MD5 71e68e4e49ffa9601bfaf90d92d147fb
BLAKE2b-256 186e458b3f1a3b0916e728e43f6783c2c456bf5bd61a94608675f3804967dcc3

See more details on using hashes here.

File details

Details for the file eaheog-0.2.16-py3-none-any.whl.

File metadata

  • Download URL: eaheog-0.2.16-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for eaheog-0.2.16-py3-none-any.whl
Algorithm Hash digest
SHA256 b16d4fa8bc86ee61dc7f05734ba46e7c1a7c09d39dcda53a8aec3311a253ea9c
MD5 af3f66dce1d9856891d6fb7d5856a3a2
BLAKE2b-256 9ead74ed1dcc5bf231838a087d499f00791f0d70f2a73527358912d01a0a3a3f

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