A comprehensive exploration of machine learning techniques for function approximation and biological time series modeling, featuring neural networks, Gaussian processes, and dynamical systems analysis.
- 1D Function Approximation: Neural network-based approximation of complex mathematical functions
- Time Series Prediction: Advanced neural networks for predicting population dynamics
- Noise Robustness Testing: Comprehensive analysis of model performance under various noise conditions
- Gaussian Process Regression: Probabilistic approach with uncertainty quantification
- Biological Modeling: Lotka-Volterra predator-prey dynamics simulation and analysis
- Model Comparison: Detailed performance metrics and visualizations
- Sinusoidal + Quadratic Function: Complex non-linear function learning
- Sum of Gaussians: Multi-modal function approximation
- MLPRegressor: Deep neural network implementation with scikit-learn
- Lotka-Volterra Model: Predator-prey population dynamics
- Differential Equation Solving: Using scipy's
solve_ivp - Phase Space Analysis: Population trajectory visualization
- Time Series Prediction: Sliding window neural networks for future prediction
- Noise Robustness: Testing model stability across noise levels (0% to 20%)
- Gaussian Process Regression: Bayesian approach with uncertainty estimation
- Performance Benchmarking: Comprehensive model comparison with multiple metrics
Python 3.8+
pip or conda package manager- Clone the repository:
git clone https://github.com/yourusername/function-approximation-time-series.git
cd function-approximation-time-series- Install dependencies:
pip install -r requirements.txt- Launch Jupyter Notebook:
jupyter notebook time_series.ipynbExecute all cells in sequence to:
- Generate synthetic training data
- Define and visualize target functions
- Train neural network models
- Perform time series prediction
- Test noise robustness
- Compare with Gaussian Process Regression
- Generate performance summaries
- Modify training data: Change
x1_datain the synthetic data section - Adjust neural network architecture: Modify
hidden_layer_sizesparameter - Test different noise levels: Update
noise_levelsarray - Experiment with GP kernels: Try different kernel combinations
The notebook generates comprehensive visualizations including:
- Function approximation plots with training points
- Time series prediction accuracy
- Noise robustness curves
- Gaussian Process uncertainty bands
- Model performance comparison charts
- Mean Squared Error (MSE): Prediction accuracy
- R² Score: Explained variance
- Mean Absolute Error (MAE): Average prediction error
- Uncertainty Quantification: 95% confidence intervals (GP only)
This project demonstrates techniques applicable to:
- Ecology: Population dynamics modeling
- Engineering: System identification and control
- Finance: Time series forecasting
- Physics: Dynamical systems analysis
- Machine Learning: Function approximation benchmarking
- MLP for Function Approximation: 2 hidden layers (20, 20 neurons)
- Time Series MLP: 3 hidden layers (50, 30, 10 neurons)
- Optimization: Adam optimizer with early stopping
- Kernels: RBF, RBF + WhiteKernel, Optimized RBF
- Hyperparameter Optimization: 10 random restarts
- Uncertainty: Full posterior distribution
- Standardization: Zero mean, unit variance scaling
- Sequence Creation: Sliding window approach for time series
- Train/Test Split: 80/20 split for temporal data
Contributions are welcome! Here are some ideas for enhancements:
- New Models: Add LSTM, GRU, or Transformer architectures
- Real Data: Incorporate actual ecological datasets
- Advanced Kernels: Implement custom GP kernels
- Hyperparameter Tuning: Add automated optimization
- Interactive Visualizations: Use Plotly for dynamic charts
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- numpy: Numerical computing
- matplotlib: Plotting and visualization
- scipy: Scientific computing and ODE solving
- scikit-learn: Machine learning algorithms
- pandas: Data manipulation and analysis
- jupyter: Interactive notebook environment
This project is licensed under the MIT License - see the LICENSE file for details.
- Lotka-Volterra equations for biological inspiration
- Scikit-learn community for excellent ML tools
- Jupyter Project for interactive computing environment