This project implements a Deep Learning model for Breast Cancer Classification using TensorFlow and Keras. The model predicts whether a tumor is Benign or Malignant based on features from the Wisconsin Breast Cancer Diagnostic Dataset.
The project demonstrates the complete machine learning workflow, including:
- Data loading and exploration
- Data preprocessing
- Feature standardization
- Train-test splitting
- Neural network development
- Model training and evaluation
- Prediction on new samples
The dataset used in this project is the Breast Cancer Wisconsin (Diagnostic) Dataset available through Scikit-Learn.
-
Total Samples: 569
-
Features: 30 numerical features
-
Classes:
- Malignant (0)
- Benign (1)
The features are computed from digitized images of breast mass cell nuclei.
- Python
- NumPy
- Pandas
- Matplotlib
- Scikit-Learn
- TensorFlow
- Keras
The dataset is loaded directly from Scikit-Learn:
import sklearn.datasets
breast_cancer_dataset = sklearn.datasets.load_breast_cancer()- Converted dataset into a Pandas DataFrame
- Checked for missing values
- Added target labels
- Split features and target variables
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_train_std = scaler.fit_transform(X_train)
X_test_std = scaler.transform(X_test)model = keras.Sequential([
keras.layers.Flatten(input_shape=(30,)),
keras.layers.Dense(20, activation='relu'),
keras.layers.Dense(2, activation='sigmoid')
])model.compile(
optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy']
)history = model.fit(
X_train_std,
Y_train,
validation_split=0.1,
epochs=10
)- Training Accuracy: ~96%
- Validation Accuracy: ~93%
- Test Accuracy: 95.61%
loss, accuracy = model.evaluate(X_test_std, Y_test)
print(accuracy)Output:
0.9561
The project includes:
- Training Accuracy vs Validation Accuracy
- Training Loss vs Validation Loss
These visualizations help monitor model performance and detect overfitting.
The trained model can predict whether a tumor is:
- Benign
- Malignant
for new patient data after applying the same preprocessing steps.
Breast-Cancer-Classification/
│
├── Breast_Cancer_Classification.ipynb
├── README.md
├── LICENSE
└── screenshots/
- Add Confusion Matrix
- Precision, Recall, and F1 Score
- ROC Curve Analysis
- Hyperparameter Tuning
- Model Deployment using Streamlit or Flask
- Save and Load Trained Models
krushna mandhare
Machine Learning and Deep Learning Enthusiast
This project is licensed under the MIT License.