Skip to content

nikikotecha/neural-function-approximation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Function Approximation and Time Series Modeling

Python 3.8+ License: MIT Jupyter

A comprehensive exploration of machine learning techniques for function approximation and biological time series modeling, featuring neural networks, Gaussian processes, and dynamical systems analysis.

🌟 Features

  • 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

📊 What's Inside

🎯 Function Approximation

  • Sinusoidal + Quadratic Function: Complex non-linear function learning
  • Sum of Gaussians: Multi-modal function approximation
  • MLPRegressor: Deep neural network implementation with scikit-learn

🔄 Dynamical Systems

  • Lotka-Volterra Model: Predator-prey population dynamics
  • Differential Equation Solving: Using scipy's solve_ivp
  • Phase Space Analysis: Population trajectory visualization

🔮 Advanced Extensions

  • 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

🚀 Quick Start

Prerequisites

Python 3.8+
pip or conda package manager

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/function-approximation-time-series.git
cd function-approximation-time-series
  1. Install dependencies:
pip install -r requirements.txt
  1. Launch Jupyter Notebook:
jupyter notebook time_series.ipynb

📝 Usage

Running the Complete Analysis

Execute all cells in sequence to:

  1. Generate synthetic training data
  2. Define and visualize target functions
  3. Train neural network models
  4. Perform time series prediction
  5. Test noise robustness
  6. Compare with Gaussian Process Regression
  7. Generate performance summaries

Customizing the Analysis

  • Modify training data: Change x1_data in the synthetic data section
  • Adjust neural network architecture: Modify hidden_layer_sizes parameter
  • Test different noise levels: Update noise_levels array
  • Experiment with GP kernels: Try different kernel combinations

📊 Results Overview

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

Key Performance Metrics

  • Mean Squared Error (MSE): Prediction accuracy
  • R² Score: Explained variance
  • Mean Absolute Error (MAE): Average prediction error
  • Uncertainty Quantification: 95% confidence intervals (GP only)

🔬 Scientific Applications

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

📚 Technical Details

Neural Network Architecture

  • 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

Gaussian Process Configuration

  • Kernels: RBF, RBF + WhiteKernel, Optimized RBF
  • Hyperparameter Optimization: 10 random restarts
  • Uncertainty: Full posterior distribution

Data Preprocessing

  • Standardization: Zero mean, unit variance scaling
  • Sequence Creation: Sliding window approach for time series
  • Train/Test Split: 80/20 split for temporal data

🤝 Contributing

Contributions are welcome! Here are some ideas for enhancements:

  1. New Models: Add LSTM, GRU, or Transformer architectures
  2. Real Data: Incorporate actual ecological datasets
  3. Advanced Kernels: Implement custom GP kernels
  4. Hyperparameter Tuning: Add automated optimization
  5. Interactive Visualizations: Use Plotly for dynamic charts

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📖 Dependencies

  • 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

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Lotka-Volterra equations for biological inspiration
  • Scikit-learn community for excellent ML tools
  • Jupyter Project for interactive computing environment

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published