A simple feedforward neural network with backpropagation for binary cancer classification.
This repository contains a Python script that implements a feedforward neural network for binary cancer classification. The network is trained using backpropagation on a dataset loaded from an Excel file. It includes data preprocessing, network structure, and training procedures.
To get started with this code, follow these steps:
- Clone this repository to your local machine.
- Ensure you have the required dependencies (listed in Dependencies).
- Run the Python script to train and evaluate the neural network.
The dataset used in this project is stored in an Excel file named 'cancer.xlsx'. The data is loaded using Pandas and processed for training. It includes input features and binary classification labels.
The neural network consists of the following layers:
- Input layer with 9 input features.
- Two hidden layers with 8 and 4 neurons, respectively.
- Output layer with 1 neuron.
Weights for each layer are initialized with random values. The activation function used is the sigmoid function.
The training of the neural network is performed using a specified number of epochs. During each epoch, the following steps are executed:
- Data shuffling and normalization.
- Feedforward algorithm to calculate the network's output.
- Backpropagation to update weights based on error and gradients.
Training progress is monitored by calculating the Mean Squared Error (MSE) and accuracy for both the training and validation sets after each epoch.
The performance of the neural network is evaluated using Mean Squared Error (MSE) and accuracy metrics on both the training and validation datasets.
This project requires the following Python libraries:
- NumPy
- Pandas
- scikit-learn (for metrics such as mean_squared_error and accuracy_score)
You can install these dependencies using pip:
pip install numpy pandas scikit-learnAmirhossein Omidi