Skip to content

SabaNrg/Bachelor-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Breast Cancer Tumor Classification: Comparing Machine Learning Methods

Project Goal

The goal of this project is to compare the performance of three different machine learning methods for classifying breast cancer tumors as benign or malignant.
The dataset comes from the UCI Breast Cancer Wisconsin (Diagnostic) dataset, which contains features extracted from digitized images of fine-needle aspirates of breast masses.

By training and evaluating three models — Neural Network (NN), Decision Tree, and Linear Support Vector Machine (SVM) — we aim to identify which method provides the most accurate predictions.


Methods

Data Preparation

  • Dataset: 569 samples with 30 numerical features per sample.
  • Target: Binary classification — Malignant (M) or Benign (B).
  • Preprocessing:
    • Features were standardized using StandardScaler.
    • Labels were converted to one-hot encoding for neural network training.
    • 80% of the dataset was used for training and 20% for testing.

1. Neural Network (NN)

  • Framework: TensorFlow / Keras
  • Architecture:
    • Input layer: 30 features
    • Dense Layer 1: 30 neurons, ReLU activation
    • Dense Layer 2: 20 neurons, ReLU activation
    • Dense Layer 3: 10 neurons, ReLU activation
    • Output Layer: 2 neurons, Softmax activation
  • Training:
    • Optimizer: Adam (learning rate = 0.001)
    • Loss: Categorical Crossentropy
    • Metric: Categorical Accuracy
    • Epochs: 100
    • Batch size: 16

2. Decision Tree

  • Framework: scikit-learn
  • Model: DecisionTreeClassifier
  • Parameters:
    • Criterion: Gini Index
    • Splitter: Best
    • Maximum depth and other hyperparameters tuned using GridSearchCV with StratifiedKFold cross-validation.
  • Evaluation: Accuracy on test data.

3. Linear Support Vector Machine (SVM)

  • Framework: scikit-learn
  • Model: LinearSVC
  • Parameters:
    • Default linear kernel
    • Regularization parameter C tuned with cross-validation
  • Features were standardized before training.

Results & Conclusion

Each model was trained and evaluated on the same dataset split.
The results were as follows:

Model Test Accuracy
Neural Network 95.61%
Decision Tree 89.47%
Linear SVM 99.12%
  • The Linear SVM achieved the highest accuracy (99.12%), making it the best-performing method in this project.
  • The Neural Network also performed very well (95.61%) and was able to capture nonlinear patterns, though it did not outperform SVM.
  • The Decision Tree had the lowest accuracy (89.47%) and showed signs of overfitting, but it remains interpretable and useful for understanding feature splits.

Conclusion: While Neural Networks are powerful and Decision Trees are highly interpretable, in this dataset the Linear SVM proved to be the most effective approach for breast cancer tumor classification.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors