The tasks in this project include:
- Implementing a Bayes optimal test for a given classification problem.
- Generating synthetic data for two classes and evaluating the Bayes classifier's error rate.
- Training neural networks on generated data using cross-entropy, exponential, and hinge methods.
- Comparing the performance of the neural networks with the Bayes optimal classifier.
- Bayes Classifier - The Bayes optimal classifier is implemented for synthetic data generated from normal distributions.
- Neural Network Training - Fully connected neural networks are trained using different loss functions and compared against the Bayes classifier.
- Image Classification Task - Neural networks are trained on MNIST-like data for digit classification.
Data.py
: Contains data generation functions for creating synthetic datasets used in the Bayes classifier and neural network training.Network.py
: Contains classes and functions for building and training neural networks, including fully connected layers, activation layers, and loss functions.main.py
: The main script for implementing and comparing the Bayes classifier with neural networks using different methods.main2.py
: A script for training neural networks on image data (e.g., MNIST).
-
Setup
- Ensure Python 3 is installed along with required libraries (NumPy, Matplotlib, Keras).
- Load necessary libraries by running:
pip install numpy matplotlib keras
- Place the data files and scripts in the same directory.
-
Running the Scripts
- Execute
main.py
to run the Bayes classification and neural network training with generated data. - Execute
main2.py
for image-based neural network classification.
- Execute
-
Visualization
- Plots showing the error rates and comparisons between different methods will be displayed using Matplotlib.
- Bayes Optimal Test: Classification using a Bayes optimal decision rule for synthetic data from normal distributions.
- Neural Networks: Fully connected networks with ReLU and sigmoid activations, trained using cross-entropy and exponential methods.
- Data: MNIST-like image data of handwritten digits.
- Neural Networks: Fully connected networks with ReLU activations, trained using cross-entropy, exponential, and hinge loss functions.