# MAYA Self-Evolution v2 Autonomous self-improvement system for steganography detection using genetic algorithms. ## Overview MAYA Self-Evolution v2 is an autonomous system that continuously improves steganography detection capabilities through genetic algorithm-based evolution. The system optimizes detection weights, thresholds, and feature importance to maximize detection accuracy. ## Features - **Genetic Algorithm Evolution**: Population-based optimization with selection, crossover, and mutation - **Fitness-Based Selection**: Elite preservation ensures best performing genomes propagate - **Diversity Preservation**: Maintains population diversity to avoid premature convergence - **Convergence Detection**: Automatically stops when improvement stagnates - **Multi-Feature Optimization**: Simultaneously optimizes 8 steganalysis features ## Supported Features 1. `lsb_variance` - LSB variance analysis 2. `alpha_entropy` - Alpha channel entropy 3. `dct_coefficients` - DCT coefficient analysis 4. `histogram_analysis` - Histogram analysis 5. `spatial_correlation` - Spatial correlation 6. `bit_plane_analysis` - Bit plane analysis 7. `chi_square` - Chi-square test 8. `rs_analysis` - RS analysis ## Usage ### Python API ```python from maya_evolution import MAYASelfEvolution, create_maya_evolution_system # Initialize system mayan = create_maya_evolution_system() # Define test results (detection confidence per feature) test_results = { "lsb_variance": 0.85, "alpha_entropy": 0.72, "dct_coefficients": 0.68, "histogram_analysis": 0.91, "spatial_correlation": 0.45, "bit_plane_analysis": 0.77, "chi_square": 0.83, "rs_analysis": 0.69 } # Run evolution for gen in range(10): state = mayan.evolve_generation(test_results) print(f"Gen {state.generation}: Best={state.best_fitness:.4f}") # Get optimized genome best = mayan.get_best_genome() print(f"Best fitness: {best.fitness}") print(f"Optimized weights: {best.detection_weights}") ``` ### Web Interface Open `maya_evolution.html` in a browser to see the interactive visualization: - Real-time fitness tracking - Feature importance charts - Evolution controls ## Files - `maya_evolution.py` - Core evolution engine - `maya_evolution.html` - Web visualization - `api.py` - Server-side API handler ## Technical Details ### Evolution Parameters - **Population Size**: 20 genomes - **Elite Size**: 4 best genomes preserved - **Crossover Rate**: 70% - **Mutation Rate**: 10% - **Convergence Threshold**: 0.001 ### Fitness Function Fitness = Weighted detection score + Diversity bonus Where diversity bonus promotes exploration of solution space. ## Security All operations use only allowed imports: - json, math, base64, hashlib, datetime, re, string - itertools, collections, dataclasses, html, urllib.parse, random No file system, network, or code execution operations.