Learning

Breast Cancer Diagnosis Machine Learning

Classify historical breast-cytology records with a transparent model

This reproducible Neural Designer example uses nine ordinal cytology ratings from the Breast Cancer Wisconsin (Original) collection. On 136 internally held-out records, the fixed linear sigmoid model reaches ROC AUC 0.998 and classifies 135 records correctly at score threshold 0.50. It is an educational benchmark—not a clinically validated diagnostic device.

0.998testing ROC AUC (95% CI 0.991–1.000)
136testing records, including 52 positive labels
100%testing sensitivity at score 0.50
98.8%testing specificity at score 0.50

1. Clinical question and intended use

The model ranks records from the supplied historical cytology table toward the processed malignant label. Its defensible role is software demonstration and retrospective method benchmarking. It may illustrate how a compact multivariable score could support research review, but it cannot establish or exclude breast cancer for a patient.

Reproducible benchmark

Inspect the exact data split, preprocessing, trained coefficients and regenerated test analyses.

Transparent scoring

Use a direct nine-input sigmoid model whose complete calculation can be reproduced in Python or the browser.

Workflow education

Demonstrate why measurement quality, threshold policy, calibration and confirmatory review remain separate requirements.

Clinical data scienceDigital pathology researchBiostatisticsLaboratory informaticsMedical ML education
Intended-use boundary. This example supports retrospective research and software verification only. It does not replace cytopathology, histopathology, multidisciplinary review or any locally approved diagnostic pathway.

2. Cohort, measurements and endpoint

The source is the Breast Cancer Wisconsin (Original) data set, donated to UCI in 1992 from cases reported by Dr William H. Wolberg at University of Wisconsin Hospitals. UCI lists 699 original records, nine integer features, a sample-code identifier, class codes 2 (benign) and 4 (malignant), and missing values in bare_nuclei.

The processed Neural Designer table removes the identifier, excludes the 16 records with missing values and recodes the target to diagnose=0 for benign and diagnose=1 for malignant. It therefore contains 683 complete records: 444 negative labels (65.0%) and 239 positive labels (35.0%).

SubsetRecordsBenign labelMalignant labelPurpose
Training411270141Estimate model parameters
Selection1369046Monitor optimization
Testing1368452Internal final evaluation
Total683444239Complete-case processed table
Input fieldScaleRecorded cytology characteristic
clump_thickness1–10Clump thickness rating
cell_size_uniformity1–10Uniformity-of-cell-size rating
cell_shape_uniformity1–10Uniformity-of-cell-shape rating
marginal_adhesion1–10Marginal-adhesion rating
single_epithelial_cell_size1–10Single epithelial-cell-size rating
bare_nuclei1–10Bare-nuclei rating
bland_chromatin1–10Bland-chromatin rating
normal_nucleoli1–10Normal-nucleoli rating
mitoses1–10Mitoses rating
Distribution of benign and malignant labels in 683 processed cytology records
The processed table contains 65.0% benign and 35.0% malignant labels; this prevalence must not be assumed for another clinical setting.
Pearson correlations between nine cytology ratings and the encoded diagnosis label
Cell-size uniformity, cell-shape uniformity and bare nuclei have the largest univariate correlations. These associations are not causal effects or proof of biological importance.
Endpoint and provenance. The processed target preserves the UCI benign/malignant class coding, but the downloadable table no longer contains the source identifier, acquisition date, patient linkage or diagnostic-adjudication details. Independent pathology confirmation and repeated-patient structure cannot be reconstructed from this file. UCI releases the data under CC BY 4.0 (DOI 10.24432/C5HP4Z).

3. Model

All nine inputs use mean-and-standard-deviation scaling. They connect directly to one sigmoid output, with no hidden layer. The model contains ten trainable parameters: nine weights and one bias. It is a logistic classifier represented in Neural Designer’s network framework.

Output contract. Larger values rank a record toward diagnose=1, the processed malignant label. No independent calibration analysis is supplied, so the sigmoid value is a model score—not an individual probability of malignancy.
Direct breast-cytology classifier with nine standardized inputs and one sigmoid output
Fixed base and final architecture: nine standardized cytology ratings connected directly to one sigmoid score. No neuron-selection or architecture-selection experiment was performed.

4. Training strategy

The stored training strategy minimizes class-weighted squared error with the quasi-Newton method and L2 regularization weight 0.01. The processed positive and negative classes receive weights 1.4289 and 0.7691, respectively.

Across 17 stored epochs (0–16), training error decreases from 0.7707 to 0.0847. Selection error starts at 0.0476, reaches its lowest displayed value at the beginning, and finishes at 0.0579. The stopping criterion is minimum loss decrease.

Weighted squared training and selection error histories for the fixed cytology classifier
The selection curve does not improve after its initial value. The article reports the stored final export rather than implying that the last epoch is an independently selected optimum.

5. Model selection and baseline

No neuron selection, input selection or architecture selection was performed. The direct 9–1 sigmoid model is both the base and final architecture. The selection subset monitors optimization only.

ReferenceTesting accuracyInterpretation
Majority-class baseline61.8%Always predict the benign label represented by 84 of 136 testing records
Fixed 9–1 model99.3%135 of 136 testing records classified correctly at score 0.50

The compact model is adequate for this internal split. Extra hidden neurons would add complexity without resolving the larger evidence limitations: exact-vector overlap, historical sampling and absence of external validation.

6. Clinical validation

The final model is evaluated on 136 testing records: 52 malignant labels (38.2% testing prevalence) and 84 benign labels. Neural Designer reports ROC AUC 0.998 with a 95% confidence interval of 0.991–1.000.

Testing ROC curve with area under the curve 0.998
The marked “optimal” point is chosen from this testing ROC curve and is descriptive. A clinical threshold would need to be prespecified or selected on separate data and then validated externally.

Operating point at score 0.50

The confusion matrix below uses the fixed reference threshold 0.50. The ROC task also reports a test-derived threshold of 0.33; it produces the same confusion counts in this split but must not be presented as an unbiased clinical cutoff.

Actual / predicted at 0.50PositiveNegativeTotal
Malignant label52052
Benign label18384
Total5383136
Testing metricValueCount-based reading
Sensitivity100%52 of 52 malignant labels detected
Specificity98.8%83 of 84 benign labels rejected
Precision / observed PPV98.1%52 of 53 positive calls match the malignant label
Observed NPV100%83 of 83 negative calls match the benign label
Accuracy99.3%135 of 136 records classified correctly
F1 score0.990Harmonic summary of precision and sensitivity
ROC AUC0.998Threshold-independent discrimination; 95% CI 0.991–1.000
Clinical interpretation. Discrimination is excellent inside this processed random split, but predictive values reflect its 38.2% testing prevalence. Moreover, 49 of the 136 testing rows share an exact nine-feature vector with at least one training row. The result therefore demonstrates internal record-level performance, not independent patient-level diagnostic validity.

7. Workflow and reproducibility

A responsible real-world analogue would start after an eligible specimen has entered an approved diagnostic pathway. It would verify specimen identity, measurement provenance and the nine-field schema, check completeness and ranges, calculate a versioned score, detect unsupported inputs, and route the result to specialist review and an established confirmatory method.

Eligible specimen and governance
Traceable cytology measurements
Schema, missingness and range checks
Versioned model score
Abstention or specialist review
Approved confirmatory pathway

Reproducible score example

The vector 5, 1, 1, 1, 2, 1, 1, 1, 1 produces a malignant-class score of 0.034283. This exact feature vector appears in more than one subset, so it verifies the calculation but is not an independent validation case.

Try the exported cytology classifier

Enter the nine ordinal ratings used by the processed data. The default vector reproduces Neural Designer’s exported calculation.

Research demonstration. The calculation runs locally with the exact exported weights and preprocessing. Values outside the validated domain are rejected. The result is not a diagnosis, does not replace pathology review and must not guide care.

Reproduce the inference

The Python package contains the exact export, ordered schema, reference input and expected score. The Neural Designer package preserves the 411/136/136 split, trained parameters and regenerated analyses.

from model import NeuralNetwork

ratings = [5, 1, 1, 1, 2, 1, 1, 1, 1]
malignant_class_score = NeuralNetwork().calculate_outputs(ratings)[0]

8. Safety, generalizability and governance

  • Internal random split only. No independent hospital, laboratory, time period, instrument or prospective cohort is evaluated.
  • Exact-vector overlap. The 683 rows collapse to 449 unique input vectors; 49 testing rows reproduce a vector already present in training. This can make internal performance optimistic.
  • Patient grouping cannot be verified. The processed table removes the source identifier, so repeated records from one patient or specimen cannot be audited or kept in one subset.
  • Complete-case restriction. Sixteen of the 699 UCI records are excluded because the source reports missing bare_nuclei. Performance does not cover incomplete inputs.
  • Reference-standard detail is incomplete. The processed file does not retain diagnostic-adjudication, biopsy, pathology, timing or follow-up metadata.
  • Scores are uncalibrated. The sigmoid output ranks the supplied class but has not been tested as an individual probability. PPV and NPV will change with prevalence.
  • No subgroup evidence. Age, ancestry, tumour subtype, lesion spectrum, operator, laboratory and device information are unavailable.
  • No clinical-utility evaluation. The example does not compare against pathologist performance, assess workflow impact, quantify net benefit or evaluate patient outcomes.
Decision boundary. Use this model for reproducible education and retrospective method research only. Any consequential interpretation requires external validation, calibration, a prespecified threshold, specialist review and an appropriate confirmatory clinical method.

References