Skip to content

πŸ’Ύ Save & Load Results

Demonstrates saving evolution results to JSON, loading them back into the SDK, and exporting them in multiple analytical formats.

What It Does

The VeoxEvolver object can serialize its entire stateβ€”including all evolved champions, the best pipeline, fitness history, and server-side run UUIDsβ€”to disk. This allows long-running evolutions to be paused, shared across teams, or continued exactly where they left off.

Export Methods

Method Returns Description
save(path) str Serializes the complete evolver state to a JSON file. Returns absolute path.
load(path) VeoxEvolver Class method to instantiate a fully configured evolver from a JSON checkpoint.
to_dict() dict Returns the raw, un-stringified result dictionary from the API.
to_json(indent=2) str Returns a pretty-printed JSON string of the results.
to_dataframe() pd.DataFrame Flattens the population timeline into a Pandas DataFrame table for plotting.

Complete Example

import os
import json
import tempfile
from sklearn.datasets import make_classification
import pandas as pd
from veox import VeoxEvolver

# 1. Generate synthetic dataset
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

# 2. Connect & run a small evolution
evolver = VeoxEvolver("binary", api_url="http://127.0.0.1:8090")
evolver.health_check()

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

print(f"Best AUC: {evolver.best_fitness_:.4f}")

# 3. Save results to disk
save_path = os.path.join(tempfile.gettempdir(), "veox_example_results.json")
saved_path = evolver.save(save_path)
print(f"Saved to: {saved_path}")

# 4. Load results into a NEW Evolver
loaded_evolver = VeoxEvolver.load(saved_path)
print(f"Loaded category:   {loaded_evolver.category}")
print(f"Loaded best score: {loaded_evolver.best_fitness_:.4f}")
print(f"Loaded pipeline:   {loaded_evolver.best_pipeline_}")

# 5. Export formats directly
result_df = loaded_evolver.to_dataframe()
print(f"DataFrame export shape: {result_df.shape}")

# Cleanup
os.remove(saved_path)

πŸ’Ž 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