Breast Cancer Classification in KNIME: Workflow, Metrics and Common Mistakes

Learn to build and evaluate a breast cancer classification workflow in KNIME using sound preprocessing, stratified validation, confusion matrices and ROC AUC.

📤 Submit AssignmentRead the guide

Classification exercises based on breast-cancer datasets are widely used to teach machine learning because the target is meaningful and the features support several modelling approaches. The main challenge is not dragging nodes onto a KNIME canvas; it is preventing leakage, validating fairly and explaining errors responsibly.

This is an educational modelling guide, not a clinical diagnostic protocol. Real clinical use requires external validation, governance, appropriate data and professional oversight.

What you will learn

  • Clean and understand the target before modelling.
  • Split data before learning preprocessing parameters.
  • Compare models using more than accuracy.
  • Explain false negatives and false positives.
  • Keep educational predictions separate from clinical decisions.

1. Define the prediction question

State the unit of analysis, target classes and intended use. For example, the task may be to classify records as benign or malignant from measured cell characteristics. Confirm whether labels are text, codes or numbers and whether any identifier accidentally encodes the outcome.

A clear question determines which rows, features and metrics are appropriate.

2. Prepare the data without leakage

  • Remove identifiers that have no predictive meaning.
  • Check missing values, duplicates and impossible measurements.
  • Inspect class counts and feature distributions.
  • Create the train/test partition before fitting normalisation or feature-selection steps.
  • Use stratified sampling so both classes are represented in each partition.

3. Build comparable KNIME branches

Create one clean preprocessing branch and feed the same training and test partitions to each learner. Common educational comparisons include logistic regression, decision trees, random forests, support vector machines and k-nearest neighbours.

Tune models on training data or through cross-validation. Do not repeatedly inspect the final test set while choosing settings.

4. Read the confusion matrix correctly

Accuracy is the proportion of all records classified correctly, but it can hide clinically important errors. Sensitivity measures how many positive cases are identified; specificity measures how many negative cases are identified. Precision shows how many predicted positives are actually positive.

State which class is treated as positive before reporting the metrics. A confusion matrix without class orientation can easily be misread.

  • True positive: a positive case predicted positive.
  • False negative: a positive case predicted negative.
  • False positive: a negative case predicted positive.
  • True negative: a negative case predicted negative.

5. Use ROC and calibration appropriately

The ROC curve compares sensitivity and false-positive rate across thresholds. AUC summarises ranking ability, but it does not tell you whether predicted probabilities are well calibrated or whether a threshold is acceptable for a specific setting.

Where probabilities matter, inspect calibration and discuss the consequences of the chosen decision threshold.

6. Report limits and reproducibility

  • Describe the dataset source and sample size.
  • Record the partition or cross-validation method and random seed.
  • List preprocessing and model settings.
  • Report several metrics with the confusion matrix.
  • Avoid presenting classroom performance as evidence of clinical effectiveness.

NEED HELP WITH YOUR ASSIGNMENT?

Submit your assignment instructions for private support.

📤 Submit Assignment

Frequently asked questions

Why can accuracy be misleading in cancer classification?

Accuracy combines all correct predictions and may conceal a high number of false negatives, especially when the classes are imbalanced.

What does AUC mean?

AUC measures how well a model ranks positive cases above negative cases across possible thresholds. It is not the same as accuracy at one threshold.

Should normalisation happen before splitting the data?

No. Parameters such as means and standard deviations should be learned from training data and then applied to the test data.

Which classifier is always best?

None. Performance depends on the data, preprocessing, validation design, tuning and the error costs relevant to the task.

References and further reading

  1. KNIME. Analytics Platform documentation.
  2. Fawcett, T. (2006). An introduction to ROC analysis. Pattern Recognition Letters, 27(8), 861–874.
  3. Dua, D., & Graff, C. UCI Machine Learning Repository: Breast Cancer Wisconsin datasets.