Physics-Informed Fractional Operator Learning for Real-Time Neurological Biomarker Detection: A Framework for Memory-Driven EEG Analysis
Project description
Neurological LRD Analysis
A comprehensive library for estimating Hurst exponents in neurological time series data, featuring multiple estimation methods, realistic data generation, and advanced benchmarking capabilities.
Developed as part of PhD research in Biomedical Engineering at the University of Reading, UK by Davian R. Chin, focusing on Physics-Informed Fractional Operator Learning for Real-Time Neurological Biomarker Detection: A Framework for Memory-Driven EEG Analysis.
Author: Davian R. Chin (PhD Candidate in Biomedical Engineering, University of Reading, UK)
Email: d.r.chin@pgr.reading.ac.uk
ORCiD: https://orcid.org/0009-0003-9434-3919
๐ Quick Start
Installation
# Install from PyPI (recommended)
pip install neurological-lrd-analysis
# Install with GPU support
pip install neurological-lrd-analysis[gpu]
# Install with development dependencies
pip install neurological-lrd-analysis[dev]
# Or install from source
git clone https://github.com/dave2k77/neurological_lrd_analysis.git
cd neurological_lrd_analysis
pip install -e .
Basic Usage
Classical Methods
from neurological_lrd_analysis import BiomedicalHurstEstimatorFactory, EstimatorType
# Create factory instance
factory = BiomedicalHurstEstimatorFactory()
# Estimate Hurst exponent using DFA
result = factory.estimate(
data=your_time_series,
method=EstimatorType.DFA,
confidence_method="bootstrap",
n_bootstrap=100
)
print(f"Hurst exponent: {result.hurst_estimate:.3f}")
print(f"Confidence interval: {result.confidence_interval}")
print(f"Data quality score: {result.data_quality_score:.3f}")
Machine Learning Methods
from neurological_lrd_analysis import (
create_pretrained_suite, quick_predict, quick_ensemble_predict,
ClassicalMLBenchmark, run_comprehensive_benchmark
)
# Create pretrained models (one-time setup)
create_pretrained_suite("pretrained_models", force_retrain=True)
# Fast ML prediction
hurst_ml = quick_predict(your_time_series, "pretrained_models", "random_forest")
# Ensemble prediction (best accuracy)
hurst_ensemble, uncertainty = quick_ensemble_predict(your_time_series, "pretrained_models")
# Comprehensive benchmark comparison
results = run_comprehensive_benchmark()
print(f"Best method: {results['best_method']}")
print(f"Performance: {results['performance_metrics']}")
Benchmark Results
# Run comprehensive benchmark
benchmark = ClassicalMLBenchmark("pretrained_models")
results = benchmark.run_comprehensive_benchmark()
# Access results
print("Performance Summary:")
for method, metrics in results['summaries'].items():
print(f"{method}: MAE={metrics.mean_absolute_error:.4f}, "
f"Time={metrics.mean_computation_time*1000:.1f}ms")
โจ Features
๐งฎ Multiple Estimation Methods
- Classical Methods: DFA, R/S Analysis, Higuchi, Generalized Hurst Exponent, Periodogram, GPH, Whittle MLE, DWT, Abry-Veitch, MFDFA
- ML Methods: Random Forest, Support Vector Regression, Gradient Boosting, Ensemble approaches
- Hybrid Approaches: Classical + ML ensemble methods for optimal performance
๐ค Machine Learning Baselines
- Feature Extraction: 74+ comprehensive features (statistical, spectral, wavelet, fractal, biomedical)
- Hyperparameter Optimization: Automated tuning with Optuna
- Pretrained Models: Fast inference with pre-trained ML models
- Ensemble Methods: Weighted combination of multiple ML models
- Real-time Inference: 10-50ms prediction times
๐ฅ Biomedical Scenarios
- EEG: Rest, eyes closed/open, sleep, seizure patterns
- ECG: Normal heart rate, tachycardia, realistic QRS complexes
- Respiratory: Breathing patterns, irregular breathing
- Neurological: Memory-driven EEG analysis, neurological biomarker detection
- Artifacts: Electrode pops, motion, baseline drift, powerline interference
- Physics-Informed Features: Fractional operator learning, real-time biomarker detection
๐ Statistical Analysis
- Bootstrap confidence intervals
- Theoretical confidence intervals
- Uncertainty quantification
- Comprehensive error metrics (bias, MAE, RMSE)
- Cross-validation and model validation
๐ Comprehensive Benchmarking
- Classical vs ML Comparison: Direct performance comparison between methods
- Real Benchmark Results: Actual performance data with CSV exports
- Visualization System: Publication-ready plots and analysis
- Performance Metrics: MAE, RMSE, correlation, computation time, success rate
- Method Rankings: Clear performance and speed rankings
โก Performance Optimization
- JAX GPU acceleration
- Numba CPU optimization
- Intelligent backend selection
- Lazy imports for efficiency
- ML model caching and fast inference
๐ Documentation
- Complete Documentation - Comprehensive guides and API reference
- Tutorial - Step-by-step tutorial with examples
- API Reference - Complete API documentation
- Configuration Guide - Application-specific configuration
- Benchmarking Guide - Enhanced benchmarking system
- Jupyter Notebooks - Interactive tutorials for demonstration and training
- 01_Biomedical_Time_Series_Analysis.ipynb - Biomedical data generation and analysis
- 02_Hurst_Estimator_Creation_and_Validation.ipynb - Estimator development and validation
- 03_Benchmarking_and_Leaderboards.ipynb - Systematic benchmarking and performance evaluation
๐ฏ Use Cases
BCI/Real-time Applications
python scripts/run_benchmark.py --success-weight 0.4 --accuracy-weight 0.2 --speed-weight 0.3 --robustness-weight 0.1
Research Applications
python scripts/run_benchmark.py --success-weight 0.2 --accuracy-weight 0.4 --speed-weight 0.1 --robustness-weight 0.3
Biomedical Scenarios
python scripts/run_benchmark.py --biomedical-scenarios eeg_rest,ecg_normal --contaminations none,noise,electrode_pop
Neurological Conditions
python scripts/run_benchmark.py --biomedical-scenarios eeg_parkinsonian,eeg_epileptic --contaminations heavy_tail,neural_avalanche
๐งช Examples and Demos
Classical Methods
# Run biomedical scenarios demonstration
python scripts/biomedical_scenarios_demo.py
# Run neurological conditions demonstration
python scripts/neurological_conditions_demo.py
# Run NumPyro integration demonstration
python scripts/numpyro_integration_demo.py
# Run application scoring demonstration
python scripts/application_scoring_demo.py
Machine Learning Methods
# Run ML baselines demonstration
python scripts/ml_baselines_demo.py
# Run pretrained models demonstration
python scripts/pretrained_models_demo.py
# Run comprehensive benchmark demonstration
python scripts/comprehensive_benchmark_demo.py
Benchmark Results
# View actual benchmark results
ls results/comprehensive_benchmark/
# - benchmark_results.csv (detailed results)
# - performance_metrics.csv (summary metrics)
# - comprehensive_benchmark_visualization.png
# - detailed_performance_analysis.png
๐งช Testing
# Run all tests
python -m pytest tests/ -v
# Run specific test categories
python -m pytest tests/test_accuracy.py -v
python -m pytest tests/test_backends.py -v
python -m pytest tests/test_registry.py -v
๐ Project Structure
neurological_lrd_analysis/
โโโ neurological_lrd_analysis/ # Main package directory
โ โโโ biomedical_hurst_factory.py # Main library file
โ โโโ benchmark_core/ # Core benchmarking functionality
โ โโโ benchmark_backends/ # Backend selection and optimization
โ โโโ benchmark_registry/ # Estimator registry system
โ โโโ ml_baselines/ # Machine learning baselines
โ โโโ feature_extraction.py # 74+ feature extraction
โ โโโ ml_estimators.py # ML model implementations
โ โโโ hyperparameter_optimization.py # Optuna integration
โ โโโ pretrained_models.py # Model management system
โ โโโ inference.py # Fast inference system
โ โโโ benchmark_comparison.py # Classical vs ML comparison
โโโ docs/ # Documentation
โโโ notebooks/ # Interactive Jupyter tutorials
โ โโโ 01_Biomedical_Time_Series_Analysis.ipynb
โ โโโ 02_Hurst_Estimator_Creation_and_Validation.ipynb
โ โโโ 03_Benchmarking_and_Leaderboards.ipynb
โ โโโ README.md
โโโ scripts/ # Demo scripts and utilities
โ โโโ ml_baselines_demo.py # ML baselines demonstration
โ โโโ pretrained_models_demo.py # Pretrained models demo
โ โโโ comprehensive_benchmark_demo.py # Full benchmark demo
โโโ tests/ # Test suite
โ โโโ test_ml_baselines.py # ML baselines tests
โ โโโ test_pretrained_models.py # Pretrained models tests
โ โโโ test_benchmark_comparison.py # Benchmark comparison tests
โโโ examples/ # Example notebooks and code
โโโ results/ # Benchmark results and outputs
โ โโโ comprehensive_benchmark/ # Actual benchmark results
โ โโโ benchmark_results.csv # Detailed results
โ โโโ performance_metrics.csv # Summary metrics
โ โโโ *.png # Visualizations
โโโ pyproject.toml # Package configuration
โโโ setup.py # Setup script
โโโ requirements.txt # Dependencies
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with JAX for GPU acceleration and physics-informed learning
- Uses NumPyro for Bayesian inference in fractional operators
- Leverages PyWavelets for wavelet-based fractional analysis
- Inspired by research in physics-informed machine learning and memory-driven neurological signal processing
๐ Citation
If you use this library in your research, please cite:
@software{neurological_lrd_analysis,
title={Neurological LRD Analysis: A Comprehensive Library for Physics-Informed Fractional Operator Learning and Real-Time Neurological Biomarker Detection},
author={Davian R. Chin},
year={2025},
institution={University of Reading, UK},
email={d.r.chin@pgr.reading.ac.uk},
orcid={https://orcid.org/0009-0003-9434-3919},
note={PhD Research in Biomedical Engineering: A Framework for Memory-Driven EEG Analysis},
url={https://github.com/dave2k77/neurological_lrd_analysis}
}
๐ฆ Releases and Versioning
This project follows Semantic Versioning and uses GitHub Actions for automated releases to PyPI.
Creating a New Release
- Bump version:
python scripts/bump_version.py 0.4.1 - Commit changes:
git add . && git commit -m "Bump version to 0.4.1" - Create tag:
git tag v0.4.1 - Push to GitHub:
git push origin main --tags - GitHub Actions will automatically:
- Run tests
- Build the package
- Publish to PyPI
- Create a GitHub release
Development Releases
For testing, you can publish to TestPyPI:
# Push to develop branch to trigger TestPyPI publishing
git checkout develop
git push origin develop
Installation Options
- Stable releases:
pip install neurological-lrd-analysis - Development versions:
pip install git+https://github.com/dave2k77/neurological_lrd_analysis.git - Test versions:
pip install --index-url https://test.pypi.org/simple/ neurological-lrd-analysis
๐ Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neurological_lrd_analysis-0.4.2.tar.gz.
File metadata
- Download URL: neurological_lrd_analysis-0.4.2.tar.gz
- Upload date:
- Size: 685.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1085d98ba7c5fc2e65a36823704408cdd63fefcc474ad03bf2cc25ea316bfc28
|
|
| MD5 |
3309513055449a4abe0fab976958c57e
|
|
| BLAKE2b-256 |
60f243ef5d3e8b4bf20a4f00def0df0cc8c2cfcf8fec880f5fa5c3ac82537cd8
|
File details
Details for the file neurological_lrd_analysis-0.4.2-py3-none-any.whl.
File metadata
- Download URL: neurological_lrd_analysis-0.4.2-py3-none-any.whl
- Upload date:
- Size: 86.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb26c800260f5c01ad399b6b6ceec890fbe8fbf2ed217c562b7ccd5b425b3426
|
|
| MD5 |
bc86295631799d85b5527fa65256d651
|
|
| BLAKE2b-256 |
43e5612503da72ae95b03e550b089bd4fd9a886d5b3076f1141474dfb3f7e326
|