Spaces:
Paused
Paused
File size: 9,079 Bytes
fb867c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
#!/usr/bin/env python3
"""
Comprehensive validation of the Felix Framework.
This script runs a complete validation of the Felix Framework including:
- All three architectures (helix, linear, mesh)
- Hypothesis validation (H1, H2, H3)
- Performance benchmarking
- Statistical analysis and research conclusions
This serves as the primary validation script for the research project,
providing publication-ready results and analysis.
"""
import time
import json
from typing import Dict, Any
from src.core.helix_geometry import HelixGeometry
from src.comparison.architecture_comparison import ArchitectureComparison, ExperimentalConfig
from src.comparison.statistical_analysis import HypothesisValidator
from src.comparison.experimental_protocol import ExperimentalProtocol
def main():
"""Run comprehensive Felix Framework validation."""
print("=" * 60)
print("FELIX FRAMEWORK COMPREHENSIVE VALIDATION")
print("=" * 60)
print()
# Initialize components
print("Initializing framework components...")
helix = HelixGeometry(
top_radius=33.0,
bottom_radius=0.001,
height=33.0,
turns=33
)
comparison = ArchitectureComparison(
helix=helix,
max_agents=50, # Reduced for faster testing
enable_detailed_metrics=True
)
validator = comparison.get_hypothesis_validator()
protocol = ExperimentalProtocol(
helix=helix,
control_variables=["agent_count", "architecture", "task_load"],
response_variables=["throughput", "completion_time", "communication_overhead"]
)
print("β Components initialized successfully")
print()
# Phase 1: Architecture Performance Comparison
print("Phase 1: Architecture Performance Comparison")
print("-" * 40)
config = ExperimentalConfig(
agent_count=20,
simulation_time=1.0,
task_load=100,
random_seed=42069
)
print(f"Running comparative experiment with {config.agent_count} agents...")
start_time = time.time()
try:
comparison_results = comparison.run_comparative_experiment(config)
print("β Comparative experiment completed")
print(f" Duration: {time.time() - start_time:.2f} seconds")
print(f" Architectures tested: {len(comparison_results.performance_metrics)}")
# Display performance summary
print("\nPerformance Summary:")
for metrics in comparison_results.performance_metrics:
print(f" {metrics.architecture_name}:")
print(f" Throughput: {metrics.throughput:.2f}")
print(f" Completion Time: {metrics.task_completion_time:.4f}s")
print(f" Communication Overhead: {metrics.communication_overhead:.4f}")
print(f" Memory Usage: {metrics.memory_usage:.0f}")
print("\nArchitecture Rankings:")
for rank, (arch, score) in enumerate(comparison_results.performance_rankings, 1):
print(f" {rank}. {arch} (score: {score:.3f})")
except Exception as e:
print(f"β Error in comparative experiment: {e}")
return False
print()
# Phase 2: Hypothesis Validation
print("Phase 2: Hypothesis Validation")
print("-" * 30)
print("Validating research hypotheses...")
hypothesis_start = time.time()
try:
# Validate all hypotheses
h1_results = validator.validate_hypothesis_h1(config)
print(f"β H1 validation completed: {h1_results.conclusion}")
h2_results = validator.validate_hypothesis_h2(config)
print(f"β H2 validation completed: {h2_results.conclusion}")
h3_results = validator.validate_hypothesis_h3(config)
print(f"β H3 validation completed: {h3_results.conclusion}")
print(f" Duration: {time.time() - hypothesis_start:.2f} seconds")
# Generate research summary
all_results = [h1_results, h2_results, h3_results]
research_summary = validator.generate_research_summary(all_results)
print(f"\nResearch Summary:")
print(f" Overall Conclusion: {research_summary['overall_conclusion']}")
print(f" Framework Validation: {research_summary['felix_framework_validation']}")
print(f"\nHypothesis Results:")
for hypothesis in ['H1', 'H2', 'H3']:
result = research_summary['hypothesis_validation_summary'][hypothesis]
print(f" {hypothesis}: {'SIGNIFICANT' if result['significant'] else 'NOT SIGNIFICANT'} "
f"(p={result['p_value']:.4f}, effect={result['effect_size']:.3f})")
except Exception as e:
print(f"β Error in hypothesis validation: {e}")
return False
print()
# Phase 3: Experimental Protocol Validation
print("Phase 3: Experimental Protocol Validation")
print("-" * 38)
print("Running validation protocol...")
protocol_start = time.time()
try:
validation_results = protocol.run_validation_protocol(
architectures=["helix_spoke", "linear_pipeline", "mesh_communication"],
agent_counts=[5, 10, 15], # Reduced for faster testing
replications=2,
random_seed=42069
)
print(f"β Validation protocol completed")
print(f" Duration: {time.time() - protocol_start:.2f} seconds")
summary = validation_results["validation_summary"]
print(f" Experiments conducted: {summary['experiment_count']}")
print(f" Architectures tested: {summary['architectures_tested']}")
print(f" Significant metrics: {summary['significant_metrics']}")
print(f" Validation strength: {summary['validation_strength']}")
print(f" Research recommendation: {summary['research_recommendation']}")
except Exception as e:
print(f"β Error in validation protocol: {e}")
return False
print()
# Phase 4: Performance Analysis
print("Phase 4: Performance Analysis")
print("-" * 26)
print("Analyzing performance characteristics...")
try:
# Throughput analysis
throughput_analysis = comparison.analyze_throughput_characteristics(comparison_results)
print("β Throughput analysis completed")
best_throughput = max(throughput_analysis["architecture_throughputs"].items(),
key=lambda x: x[1])
print(f" Best throughput: {best_throughput[0]} ({best_throughput[1]:.2f})")
# Memory analysis
memory_analysis = comparison.analyze_memory_usage(comparison_results)
print("β Memory usage analysis completed")
most_efficient = memory_analysis["memory_efficiency_rankings"][0]
print(f" Most memory efficient: {most_efficient[0]} ({most_efficient[1]:.0f} units)")
# Latency analysis
latency_analysis = comparison.analyze_latency_distribution(comparison_results)
print("β Latency distribution analysis completed")
if latency_analysis["mean_latencies"]:
lowest_latency = min(latency_analysis["mean_latencies"].items(),
key=lambda x: x[1])
print(f" Lowest latency: {lowest_latency[0]} ({lowest_latency[1]:.6f}s)")
except Exception as e:
print(f"β Error in performance analysis: {e}")
return False
print()
# Final Summary
print("=" * 60)
print("VALIDATION SUMMARY")
print("=" * 60)
total_time = time.time() - start_time
print(f"Total validation time: {total_time:.2f} seconds")
print()
print("Architecture Performance:")
winner = comparison_results.performance_rankings[0]
print(f" Best overall performance: {winner[0]} (score: {winner[1]:.3f})")
print()
print("Hypothesis Validation:")
supported_count = sum(1 for h in ['H1', 'H2', 'H3']
if research_summary['hypothesis_validation_summary'][h]['significant'])
print(f" Hypotheses supported: {supported_count}/3")
if supported_count >= 2:
print(" β FELIX FRAMEWORK VALIDATION: SUCCESSFUL")
print(" Sufficient evidence to support core research claims")
else:
print(" β FELIX FRAMEWORK VALIDATION: PARTIAL")
print(" Limited evidence for research claims - additional research needed")
print()
print("Research Readiness:")
if summary['research_recommendation'] == "Publication ready":
print(" β PUBLICATION READY: Results suitable for peer review")
else:
print(" β ADDITIONAL RESEARCH NEEDED: Strengthen evidence before publication")
print()
print("Felix Framework comprehensive validation completed successfully!")
print("=" * 60)
return True
if __name__ == "__main__":
success = main()
exit(0 if success else 1) |