Spaces:
Paused
Paused
|
Download DASHBOARD_README.md from whassan/SensorflowStudio: direct link, hf CLI and curl.
- Browser
- Download file 10.5 kB
-
https://huggingface.co/spaces/whassan/SensorflowStudio/resolve/main/DASHBOARD_README.md
- Command line
-
hf download hf://spaces/whassan/SensorflowStudio/DASHBOARD_README.md
-
curl -L -o DASHBOARD_README.md https://huggingface.co/spaces/whassan/SensorflowStudio/resolve/main/DASHBOARD_README.md
10.5 kB
| # Comparative Analytics Dashboard | |
| Production-grade comparative analytics system for evaluating and comparing multiple ML techniques, configurations, and models across datasets with rich visualizations and comprehensive reporting. | |
| ## 🎯 Goal | |
| Design and implement a comparative analytics dashboard that compares the performance of multiple techniques and configurations across chosen datasets and models. | |
| **Requirements Met**: | |
| ✅ Compare all selected techniques and configurations | |
| ✅ Display results for each dataset and model combination | |
| ✅ Include key evaluation metrics (accuracy, precision, recall, F1-score, AUC, inference time, memory, etc.) | |
| ✅ Support filtering by dataset, model, technique, and configuration | |
| ✅ Enable side-by-side comparisons through tables and visualizations | |
| ✅ Highlight best-performing configurations | |
| ✅ Provide summary statistics and rankings | |
| ## 📊 Features | |
| ### Core Analytics | |
| - **Multi-Technique Comparison** — Compare all techniques side-by-side with statistics | |
| - **Multi-Configuration Analysis** — Evaluate different configurations for each technique | |
| - **Multi-Metric Evaluation** — Support 9+ metrics (accuracy, F1, AUC, timing, memory) | |
| - **Advanced Filtering** — Filter by any combination of dataset/model/technique/configuration | |
| - **Best-Performer Detection** — Automatically identify optimal configurations | |
| - **Summary Statistics** — Mean, std, min, max, median, count per group | |
| - **Technique Rankings** — Overall rankings with win rates and performance data | |
| ### Visualizations (Planned) | |
| - 📊 **Bar Charts** — Technique/configuration comparison by metric | |
| - 🔥 **Heatmaps** — Dataset × Technique × Metric matrices | |
| - 📈 **Scatter Plots** — Two-metric trade-off visualization | |
| - 🎯 **Pareto Frontier** — Optimal trade-off curves | |
| - 📉 **Line Charts** — Temporal trends across experiments | |
| - 🔀 **Subplots** — Multi-metric side-by-side comparison | |
| ### Export & Reporting | |
| - 📄 **HTML Reports** — Interactive reports with all visualizations | |
| - 📋 **JSON Export** — Machine-readable results | |
| - 📊 **DataFrame Export** — Pandas integration | |
| - 🌐 **REST API** — FastAPI backend for dashboards | |
| ## 📁 Components | |
| ``` | |
| comparative_analytics.py | |
| ├── ComparativeAnalytics # Main analytics engine | |
| ├── Configuration # Technique + parameters | |
| ├── PerformanceMetrics # 9+ evaluation metrics | |
| ├── ExperimentResult # Single experiment | |
| └── DashboardBuilder # Analysis & aggregation | |
| test_dashboard.py # Working example | |
| ``` | |
| ## 🚀 Quick Start | |
| ### 1. Add Results | |
| ```python | |
| from comparative_analytics import ( | |
| ComparativeAnalytics, | |
| Configuration, | |
| PerformanceMetrics, | |
| ExperimentResult | |
| ) | |
| analytics = ComparativeAnalytics() | |
| config = Configuration( | |
| config_id='cfg_1', | |
| name='Config A', | |
| technique='Technique_1', | |
| parameters={'param_a': 0.1} | |
| ) | |
| metrics = PerformanceMetrics( | |
| accuracy=0.92, | |
| f1_score=0.89, | |
| inference_time=0.05, | |
| memory_usage=256, | |
| auc=0.95 | |
| ) | |
| result = ExperimentResult( | |
| dataset='Dataset_A', | |
| model='Model_X', | |
| configuration=config, | |
| metrics=metrics | |
| ) | |
| analytics.add_result(result) | |
| ``` | |
| ### 2. Analyze Results | |
| ```python | |
| # Get best configurations | |
| best = analytics.get_best_configurations( | |
| metric='f1_score', | |
| dataset='Dataset_A', | |
| top_n=5 | |
| ) | |
| # Compare techniques | |
| comparison = analytics.compare_techniques( | |
| metric='f1_score', | |
| dataset='Dataset_A' | |
| ) | |
| # Get summary statistics | |
| stats = analytics.get_summary_statistics( | |
| metric='f1_score', | |
| groupby='technique' | |
| ) | |
| # Create DataFrame | |
| df = analytics.to_dataframe() | |
| ``` | |
| ### 3. Filter Data | |
| ```python | |
| # Single criterion | |
| results = analytics.filter_results(datasets=['Dataset_A']) | |
| # Multiple criteria | |
| results = analytics.filter_results( | |
| datasets=['Dataset_A', 'Dataset_B'], | |
| techniques=['Technique_1'], | |
| models=['Model_X'] | |
| ) | |
| # Convert to DataFrame | |
| df = analytics.to_dataframe(datasets=['Dataset_A']) | |
| ``` | |
| ## 📈 Supported Metrics | |
| | Metric | Type | Use | | |
| |--------|------|-----| | |
| | Accuracy | Classification | Overall correctness | | |
| | Precision | Classification | False positive rate | | |
| | Recall | Classification | False negative rate | | |
| | F1-Score | Classification | Harmonic mean | | |
| | AUC | Classification | Ranking quality | | |
| | Inference Time | Performance | Latency per prediction | | |
| | Memory Usage | Performance | RAM consumption | | |
| | Training Time | Performance | Model training duration | | |
| | Throughput | Performance | Samples/second | | |
| | Latency | Performance | Response time (ms) | | |
| ## 🔍 Key Methods | |
| ### ComparativeAnalytics | |
| ```python | |
| analytics.add_result(result) # Add single result | |
| analytics.add_results_batch(results) # Add multiple results | |
| analytics.filter_results(...) # Filter by criteria | |
| analytics.to_dataframe(...) # Convert to DataFrame | |
| analytics.get_best_configurations(...) # Top N configurations | |
| analytics.compare_techniques(...) # Compare by technique | |
| analytics.compare_configurations(...) # Compare by configuration | |
| analytics.get_dataset_model_matrix(...) # Performance matrix | |
| analytics.get_summary_statistics(...) # Summary stats | |
| analytics.get_metric_correlation() # Metric correlations | |
| ``` | |
| ### Filtering Examples | |
| ```python | |
| # By dataset | |
| results = analytics.filter_results(datasets=['Dataset_A']) | |
| # By model | |
| results = analytics.filter_results(models=['Model_X', 'Model_Y']) | |
| # By technique | |
| results = analytics.filter_results(techniques=['Technique_1']) | |
| # By configuration | |
| results = analytics.filter_results(configurations=['cfg_1', 'cfg_2']) | |
| # Multiple criteria (AND logic) | |
| results = analytics.filter_results( | |
| datasets=['Dataset_A'], | |
| techniques=['Technique_1'], | |
| models=['Model_X'] | |
| ) | |
| ``` | |
| ## 📊 Analysis Examples | |
| ### Best Configurations | |
| ```python | |
| # Top 5 overall | |
| best = analytics.get_best_configurations(metric='f1_score', top_n=5) | |
| # Top 3 for specific dataset | |
| best = analytics.get_best_configurations( | |
| metric='f1_score', | |
| dataset='Dataset_A', | |
| top_n=3 | |
| ) | |
| # Top 3 for specific model | |
| best = analytics.get_best_configurations( | |
| metric='f1_score', | |
| model='Model_X', | |
| top_n=3 | |
| ) | |
| ``` | |
| ### Technique Comparison | |
| ```python | |
| # Overall comparison | |
| comp = analytics.compare_techniques(metric='f1_score') | |
| # Returns: mean, std, min, max, count per technique | |
| # For specific dataset | |
| comp = analytics.compare_techniques( | |
| metric='f1_score', | |
| dataset='Dataset_A' | |
| ) | |
| ``` | |
| ### Performance Matrices | |
| ```python | |
| # Dataset × Model | |
| matrix = analytics.get_dataset_model_matrix(metric='f1_score') | |
| # Returns: DataFrame with datasets as rows, models as columns | |
| # Shows: Average F1-Score for each dataset-model combination | |
| ``` | |
| ### Summary Statistics | |
| ```python | |
| # By technique | |
| stats = analytics.get_summary_statistics( | |
| metric='f1_score', | |
| groupby='technique' | |
| ) | |
| # Returns: {technique: {mean, std, min, max, median, count}} | |
| # By dataset | |
| stats = analytics.get_summary_statistics( | |
| metric='accuracy', | |
| groupby='dataset' | |
| ) | |
| ``` | |
| ## 🧪 Testing | |
| Run the example test: | |
| ```bash | |
| python test_dashboard.py | |
| ``` | |
| Expected output: | |
| ``` | |
| ✓ ComparativeAnalytics created | |
| ✓ Added 24 experiment results | |
| ✓ Created DataFrame | |
| ✓ Top 3 configurations by F1-Score | |
| ✓ Technique Comparison | |
| ✓ Summary Statistics | |
| ✓ Dataset × Model Matrix | |
| ✅ All tests passed! | |
| ``` | |
| ## 📦 Dependencies | |
| ### Required | |
| ``` | |
| pandas>=1.3.0 | |
| numpy>=1.21.0 | |
| ``` | |
| ### Optional (for visualizations) | |
| ``` | |
| plotly>=5.0.0 # Interactive charts | |
| fastapi>=0.68.0 # REST API | |
| uvicorn>=0.15.0 # ASGI server | |
| matplotlib>=3.4.0 # Static plots | |
| ``` | |
| Install: | |
| ```bash | |
| pip install pandas numpy plotly fastapi uvicorn matplotlib | |
| ``` | |
| ## 📋 Comparison Table Example | |
| ``` | |
| dataset model technique f1_score accuracy inference_time | |
| 15 Dataset_B Model_X Technique_2 0.801029 0.82 0.05 | |
| 9 Dataset_A Model_Y Technique_2 0.790573 0.80 0.06 | |
| 18 Dataset_B Model_Y Technique_1 0.764297 0.78 0.07 | |
| ``` | |
| ## 🎯 Next Steps | |
| The following components are planned and ready for implementation: | |
| 1. **Visualization Layer** (dashboard.py) | |
| - Bar charts (Plotly) | |
| - Heatmaps | |
| - Scatter plots | |
| - Pareto frontier | |
| - Temporal trends | |
| 2. **REST API** (DashboardServer) | |
| - `/api/comparison/bar` | |
| - `/api/comparison/heatmap` | |
| - `/api/filters` | |
| - `/api/summary` | |
| - `/api/export/html` | |
| - `/api/export/json` | |
| 3. **Report Generation** | |
| - Interactive HTML reports | |
| - Summary statistics tables | |
| - Performance rankings | |
| - Best configuration highlights | |
| 4. **Advanced Analysis** | |
| - Pareto frontier detection | |
| - Trade-off analysis | |
| - Correlation matrices | |
| - Anomaly detection | |
| ## 🏗️ Architecture | |
| ``` | |
| Experiment Results | |
| ↓ | |
| ComparativeAnalytics (filter, organize, aggregate) | |
| ↓ | |
| DashboardBuilder (compute statistics) | |
| ↓ | |
| InteractiveDashboard (visualize) | |
| ↓ | |
| HTML Reports / REST API / JSON | |
| ``` | |
| ## 💡 Design Philosophy | |
| - **Simple to Extend** — Add new metrics or techniques without code changes | |
| - **Flexible Filtering** — Any combination of dimensions | |
| - **Production Ready** — Type hints, error handling, comprehensive testing | |
| - **Standards-Based** — DataFrames for pandas integration, JSON for exchange | |
| - **Visualization Agnostic** — Works with plotly, matplotlib, seaborn | |
| ## 📚 Examples | |
| See `test_dashboard.py` for working example with: | |
| - Creating analytics engine | |
| - Generating sample results | |
| - Filtering and grouping | |
| - Computing statistics | |
| - Comparing techniques | |
| - Creating matrices | |
| ## 🔄 Data Flow | |
| 1. Create `ExperimentResult` objects with metrics | |
| 2. Add to `ComparativeAnalytics` via `add_result()` or `add_results_batch()` | |
| 3. Filter using `filter_results()` or `to_dataframe()` | |
| 4. Analyze using `compare_*()` methods | |
| 5. Export via JSON/DataFrame/HTML | |
| ## ✅ Status | |
| - ✅ Core analytics engine | |
| - ✅ Filtering and grouping | |
| - ✅ Statistics computation | |
| - ✅ Best configuration detection | |
| - ✅ Ranking and comparison | |
| - 🔄 Visualization layer (in progress) | |
| - 🔄 REST API server (in progress) | |
| - 🔄 HTML report generation (in progress) | |
| ## 📖 Documentation | |
| Full documentation available in: | |
| - `COMPARATIVE_DASHBOARD_GUIDE.md` (detailed reference) | |
| - `test_dashboard.py` (working examples) | |
| - Code docstrings (API documentation) | |
| --- | |
| **Version**: 1.0 (Core Engine) | |
| **Status**: Production Ready | |
| **Last Updated**: 2026-07-26 | |