Skip to content

⚖️ Multi-Family Comparison

Run multiple algorithm families side-by-side and display a comparison table.

Note

This example demonstrates the SDK's unified scikit-learn interface. Under the hood, completely different multi-stage pipelines and distributed evaluations are orchestrated for each family, but the API remains evolver.fit(data).

What It Shows

  1. Object Reusability: Instantiating separate VeoxEvolver objects for different algorithmic families (binary, regression, outlier).
  2. Dashboard Suppression: Disabling the live generic terminal dashboard (verbose=False) so we can print custom multiprocess outputs.
  3. Universality: Using .fit(), querying .best_fitness_, and .best_pipeline_ identically regardless of the underlying problem shape.

Example Code

import os
import time
import numpy as np
from sklearn.datasets import make_classification, make_regression, make_blobs
import pandas as pd
from veox import VeoxEvolver

def make_binary_data() -> pd.DataFrame:
    X, y = make_classification(n_samples=300, n_features=10, n_informative=6,
                                random_state=42)
    df = pd.DataFrame(X, columns=[f"f{i}" for i in range(10)])
    df["target"] = y
    return df

def make_regression_data() -> pd.DataFrame:
    X, y = make_regression(n_samples=300, n_features=10, n_informative=6,
                            noise=15, random_state=42)
    df = pd.DataFrame(X, columns=[f"f{i}" for i in range(10)])
    df["target"] = y
    return df

def make_outlier_data() -> pd.DataFrame:
    X_normal, _ = make_blobs(n_samples=270, centers=3, n_features=10,
                              cluster_std=1.5, random_state=42)
    rng = np.random.RandomState(42)
    X_anomaly = rng.uniform(X_normal.min(axis=0) - 2,
                             X_normal.max(axis=0) + 2, size=(30, 10))
    X = np.vstack([X_normal, X_anomaly])
    y = np.array([0] * 270 + [1] * 30)
    idx = rng.permutation(len(X))
    X, y = X[idx], y[idx]
    df = pd.DataFrame(X, columns=[f"f{i}" for i in range(10)])
    df["target"] = y
    return df

FAMILIES = [
    ("binary",     "AUC",    make_binary_data),
    ("regression", "R²",     make_regression_data),
    ("outlier",    "AUC",    make_outlier_data),
]

api_url = os.environ.get("VEOX_API_URL", "http://127.0.0.1:8090")

# Health check (verbose=False silences the connection logs)
ev = VeoxEvolver("binary", api_url=api_url, verbose=False)
ev.health_check()

results = []

for family, metric_name, data_fn in FAMILIES:
    print(f"\nRunning: {family.upper()} (metric: {metric_name})")
    df = data_fn()

    # Instantiate new evolver for this family
    evolver = VeoxEvolver(family, api_url=api_url)

    t0 = time.time()
    evolver.fit(
        data=df,
        target_column="target",
        max_generations=2,
        population_size=10,
        num_islands=1,
        timeout_per_eval=30,
        max_poll_time=120,
    )
    elapsed = time.time() - t0

    results.append({
        "family": family,
        "score": evolver.best_fitness_,
        "evals": evolver.result_.total_evals,
        "elapsed": elapsed,
        "status": evolver.result_.status,
    })

# Summary table
print("\n" + "="*60)
for r in results:
    print(f"{r['family']:<14} | Score: {r['score']:>+7.4f} | Evals: {r['evals']:>4} | Time: {r['elapsed']:>5.1f}s")
print("="*60)

💎 VEOX Pro Activation

To unlock VIP Evaluators and Pro Algorithms (like PaperKit and Generative routines), you must authenticate your local node with a VEOX License Token.

from veox import VeoxEvolver

evolver = VeoxEvolver("binary", api_url="http://127.0.0.1:8090")

# 1. Fetch your unique Hardware Fingerprint
fingerprint = evolver.get_system_fingerprint()
print(f"My VEOX Node Fingerprint: {fingerprint}")
# Example Output: My VEOX Node Fingerprint: 476ad03474b31e3c84d07df9088d93f0

# 2. Provide this fingerprint to your VEOX Admin to receive a JWT Token
jwt_token = "eyJ0b2tlbiI6ICJVRExK...EXPIRES"  # Replace with your token

# 3. Activate the Enclave
if evolver.activate_license(jwt_token):
    print("VIP Features Unlocked!")
    # evolver.fit(...) will now utilize full Pro capabilities