This repository contains code for detecting cancer using a simple neural network built with TensorFlow and Keras. The dataset used in this project includes various features extracted from cell nuclei images. The goal is to predict whether a tumor is malignant (cancerous) or benign based on these features.
Cancer detection is one of the critical applications in healthcare. This project demonstrates how to train a neural network to classify tumors as malignant (1) or benign (0) based on specific cell measurements. The dataset is split into training and testing sets to evaluate the model's performance.
The neural network consists of three dense layers and uses the sigmoid activation function to output a probability indicating the likelihood of the tumor being malignant.
The dataset used for this project is expected to be in CSV format (CancerStats.csv
). The dataset should contain various features for each tumor, and the target variable is the diagnosis(1=m, 0=b)
column, where 1
represents malignant and 0
represents benign tumors.
- The features are various characteristics of the tumor, such as size, texture, and smoothness.
- The target variable is the
diagnosis(1=m, 0=b)
column, where:1
stands for malignant (cancerous)0
stands for benign
The neural network model consists of three layers:
- Input Layer: A dense layer with 256 units, using a sigmoid activation function.
- Hidden Layer: A dense layer with 256 units, using a sigmoid activation function.
- Output Layer: A dense layer with 1 unit and sigmoid activation for binary classification.
- Optimizer:
Adam
- Loss function:
binary_crossentropy
- Metric:
accuracy
Layer (type) Output Shape Param #
=================================================================
dense (Dense) (None, 256) <calculated_param_count>
_________________________________________________________________
dense_1 (Dense) (None, 256) <calculated_param_count>
_________________________________________________________________
dense_2 (Dense) (None, 1) <calculated_param_count>
=================================================================
To get started with this project, follow these steps:
git clone https://github.com/kiruthikpurpose/CancerDetectionModel.git
pip install -r Requirements.txt
Ensure that the dataset (CancerStats.csv) is in the root folder of the project.
To train the model, run the following command:
python CancerDetectionModel.py
This script will:
Load the dataset from CancerStats.csv Split it into training and testing sets Define the neural network model Train the model for 100 epochs Evaluate the model on the test set