This code implements a simple neural network from scratch using Python and NumPy. The neural network is trained on the Heart Attack Analysis & Prediction Dataset obtained from Kaggle. It follows a basic architecture with a single hidden layer and uses the sigmoid activation function. The training process includes forward and backward passes along with weight updates using stochastic gradient descent. Additionally, it evaluates the model's performance by plotting the loss curve and calculating the accuracy and confusion matrix on a test set.
Make sure you have Python installed on your system along with the required libraries specified in the packages section. Download the dataset heart.csv from the Kaggle link provided in the code.
Ensure the dataset file heart.csv is in the same directory as the script. Execute the script in a Python environment.
The script will train the neural network on the dataset and output a loss curve plot. It will also calculate the accuracy of the model and display the confusion matrix.
Hyperparameters such as learning rate (LR) and number of iterations (ITERATIONS) can be adjusted in the script to optimize performance.
- Python 3.x
- NumPy
- Pandas
- Seaborn
- Scikit-learn
Dataset Source: Dataset