Approximate the cosine function using a simple neural network from scratch!
This project demonstrates how a neural network can learn to approximate the mathematical cos(x) function using supervised learning.
- 📚 Implemented entirely in Python and Jupyter Notebook.
- 🧮 Uses a simple fully connected neural network.
- 🏗️ Built from scratch — no deep learning frameworks (such as TensorFlow or PyTorch) required!
- 📈 Visualizes both the training process and the approximation performance.
- 🎓 Great for educational purposes and understanding how neural networks learn mathematical functions.
Neural_Cosine_Approximator.ipynb— Main notebook containing:- Data preparation
- Neural network implementation
- Training loop
- Evaluation & visualization
- Python >= 3.8
- NumPy
- Matplotlib
- Jupyter Notebook
You can install the required libraries using:
pip install numpy matplotlib jupyter- Clone the repository:
git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git
cd YOUR_REPOSITORY- Launch the notebook:
jupyter notebook Neural_Cosine_Approximator.ipynb- Run the cells and enjoy watching your neural network approximate
cos(x)!
- Understand how neural networks can approximate continuous functions.
- Learn how to implement a basic neural network without external frameworks.
- Visualize model learning and performance.
This project is licensed under the MIT License.
Sayyed Hossein Hosseini DolatAbadi
🌟 If you like this project, consider giving it a ⭐ on GitHub!