π Quick Start Guideο
This guide will get you up and running with RexF in under 5 minutes.
Installationο
Install RexF using pip:
pip install rexf
Thatβs it! No additional setup required.
Your First Experimentο
Letβs create a simple experiment to estimate Ο using Monte Carlo methods:
import math
import random
from rexf import experiment, run
@experiment
def estimate_pi(num_samples=10000):
"""Estimate Ο using Monte Carlo methods."""
inside_circle = 0
for _ in range(num_samples):
x, y = random.uniform(-1, 1), random.uniform(-1, 1)
if x*x + y*y <= 1:
inside_circle += 1
pi_estimate = 4 * inside_circle / num_samples
error = abs(pi_estimate - math.pi)
return {
"pi_estimate": pi_estimate,
"error": error,
"accuracy": 1 - (error / math.pi)
}
# Run a single experiment
run_id = run.single(estimate_pi, num_samples=50000)
print(f"Experiment completed with ID: {run_id}")
Running this code will:
Execute your experiment function
Automatically capture parameters (
num_samples=50000)Store the results (
pi_estimate,error,accuracy)Track execution time and environment info
Generate a unique run ID
Exploring Resultsο
Now letβs explore what RexF captured:
# Get recent experiments
recent_runs = run.recent(hours=1)
print(f"Found {len(recent_runs)} recent experiments")
# Get the best experiments by accuracy
best_runs = run.best(metric="accuracy", top=3)
for exp in best_runs:
print(f"Run {exp.run_id[:8]}: accuracy={exp.metrics['accuracy']:.4f}")
# Generate insights
insights = run.insights()
print(f"Success rate: {insights['summary']['success_rate']:.1%}")
Auto-Explorationο
Let RexF automatically explore different parameter values:
# Automatically explore parameter space
run_ids = run.auto_explore(
estimate_pi,
strategy="random", # or "grid", "adaptive"
budget=10, # number of experiments to run
optimization_target="accuracy"
)
print(f"Completed {len(run_ids)} experiments")
# Find the best result
best = run.best(metric="accuracy", top=1)[0]
print(f"Best accuracy: {best.metrics['accuracy']:.4f}")
print(f"With parameters: {best.parameters}")
Querying Experimentsο
Find experiments using simple expressions:
# Find high-accuracy experiments
high_acc = run.find("accuracy > 0.99")
print(f"Found {len(high_acc)} high-accuracy experiments")
# Find experiments with specific parameter ranges
large_samples = run.find("param_num_samples > 25000")
print(f"Found {len(large_samples)} experiments with large sample sizes")
# Combine conditions
recent_good = run.find("accuracy > 0.95 and num_samples > 10000")
Web Dashboardο
Launch the interactive web dashboard:
# This will open your browser to http://localhost:8080
run.dashboard()
The dashboard provides:
Real-time experiment monitoring
Interactive charts and visualizations
Experiment comparison tools
Parameter space exploration
Automated insights
CLI Analyticsο
You can also analyze experiments from the command line:
# Show experiment summary
rexf-analytics --summary
# Query experiments
rexf-analytics --query "accuracy > 0.99"
# Generate insights
rexf-analytics --insights
# Launch web dashboard
rexf-analytics --dashboard
Next Stepsο
Now that youβve got the basics down, explore:
π Basic Usage - Learn all core features
π Advanced Features - Advanced exploration and insights
π― Tutorial: Monte Carlo Ο Estimation - Complete Monte Carlo tutorial
π Web Dashboard - Dashboard features and customization
π Youβre ready to accelerate your research with RexF!