Learning

Breast cancer mortality prediction with machine learning

Analyse five-year breast cancer survival from clinical and molecular data

This fixed-horizon survival analysis asks whether the recorded outcome occurs within five years. It combines clinical, treatment, gene-expression and mutation variables and implements the survival endpoint as binary classification. After growing-input selection, the final 95-feature sigmoid classifier reaches ROC AUC 0.746 on 351 held-out rows.

0.746testing ROC AUC (95% CI 0.685–0.806)
65.7%sensitivity at threshold 0.50
70.1%specificity at threshold 0.50
351held-out testing rows

1. Scientific objective

The scientific objective is five-year overall-survival analysis. For each eligible row, the prepared target overall_mortality indicates whether death was recorded within the five-year horizon: label 1 is the event class and label 0 is five-year survival. Neural Designer therefore solves a fixed-horizon survival classification problem. Unlike a time-to-event model, it estimates one endpoint at five years and does not produce a complete survival or hazard curve.

Method development

Explore mixed clinical, categorical, transcriptomic and mutation inputs in one reproducible classification pipeline.

Five-year stratification

Quantify how well the model separates the recorded five-year mortality and survival classes in a held-out subset.

Reproducible review

Export the trained calculation and its exact 76-to-95 feature encoding for retrospective batch analysis.

Clinical data scientistsBiostatisticiansTranslational researchersBioinformaticiansOncology research teams
Scope. This is an educational retrospective survival analysis at a fixed five-year horizon. It demonstrates model construction and evaluation; it is not a validated individual survival calculator and must not guide diagnosis, treatment or patient counselling.

2. Data and provenance

The prepared table contains 1,880 rows and 689 columns: one local identifier, 687 candidate predictors and the target. The predictors comprise 25 clinical/treatment descriptors, 489 gene-expression measurements and 173 mutation indicators. The target is observed for 1,755 rows; 125 rows labelled NA are unused.

SubsetRowsPositive labelsPurpose
Training1,053Stored in projectEstimate model parameters
Selection351Stored in projectSelect the input subset and monitor training
Testing35167Final internal evaluation
Unused125Target unavailableExcluded from modelling

Among the 1,755 eligible rows, 325 (18.5%) carry the five-year mortality label and 1,430 (81.5%) carry the five-year survival label. This imbalance makes raw accuracy a poor headline metric.

Distribution of the five-year survival outcome
Mortality within five years represents 18.5% of eligible rows; 125 rows without an available endpoint are excluded.
Largest univariate correlations with the mortality target
Tumour stage and positive lymph-node count have the largest displayed absolute correlations. These are univariate associations, not causal effects or multivariable feature importance.

Predictor groups

GroupExamplesImportant timing question
Clinical and tumourage_at_diagnosis, stage, size, receptor status, positive nodesAvailable at or shortly after diagnosis?
TreatmentSurgery type, chemotherapy, hormone therapy, radiotherapyAssigned before the intended prediction time?
Molecular489 expression measurements and 173 mutation indicatorsAssay platform and preprocessing compatible?
Survival-endpoint provenance. The table is derived from the METABRIC collection distributed through cBioPortal. It preserves the five-year binary outcome used by this example, but not the underlying follow-up time, event time or censoring rule. Those fields are required to audit the endpoint or extend the study to full time-to-event modelling.

3. Model

The initial model uses all 687 raw candidate predictors. Categorical expansion produces 722 numeric inputs, followed by scaling and one sigmoid output. With no hidden layer, this is a linear, logistic-like classifier with 723 trainable parameters—not a deep network.

Output contract. A larger sigmoid value means stronger evidence for the five-year mortality class under this fitted cohort; a smaller value favours the five-year survival class. The score orders cases, but no calibration analysis shows that it equals an individual mortality or survival probability.
Initial network with 687 raw candidate predictors and one mortality output
Initial all-input architecture. The graph summarizes 687 raw predictors; categorical encoding expands them to 722 numeric model inputs.

4. Training strategy

The first direct classifier is optimized with the quasi-Newton method using weighted squared error. Training error falls from 0.8825 to 0.0818 across 72 epochs, while selection error reaches its minimum early and ends at 0.7460. The widening gap is clear evidence of overfitting.

Initial training and selection error history
The all-input model continues fitting the training rows after selection performance has stopped improving.
Why selection is needed. With 722 encoded inputs but only 1,053 training rows, the unrestricted direct model has enough flexibility to memorize cohort-specific structure.

5. Model selection and baseline

This project performs input selection, not neuron selection. A growing-input search adds variables according to selection performance and reaches its lowest stored selection error with 76 raw variables.

Growing-input training and selection errors
The selected endpoint is the 76-variable subset at the right edge of the stored search. Because the minimum is boundary-adjacent, the result should be treated as one fitted subset rather than a stable biological signature.

Final model

The 76 selected raw variables expand to 95 numeric inputs: 19 clinical/categorical indicators, 63 gene-expression measurements and three mutation indicators. The final 95-to-1 sigmoid classifier contains 96 trainable parameters.

76 raw variablesSelected clinical and molecular fields
95 numeric inputsScaling and one-hot encoding
1 sigmoid scoreDirect linear classification layer

Retraining the reduced model for 33 epochs lowers training weighted squared error from 0.7571 to 0.4609 and selection error from 0.4354 to 0.3151.

Final training history after growing-input selection
The reduced model trains without the severe divergence seen in the all-input baseline.

6. Scientific validation

The final model is evaluated on the 351 testing rows only after training and input selection. Neural Designer reports ROC AUC 0.746 with a 95% confidence interval of 0.685–0.806. This indicates moderate internal discrimination with substantial uncertainty.

Testing ROC curve for the breast-cancer mortality classifier
ROC curve on the held-out testing subset. The marked threshold is selected from this same curve and is descriptive, not a prespecified clinical cutoff.
Actual / predicted at 0.50Label 1Label 0Total
Actual label 1442367
Actual label 085199284
Total129222351
Testing metricValueProfessional reading
Sensitivity65.7%44 of 67 positive labels detected
Specificity70.1%199 of 284 negative labels rejected
Precision34.1%44 of 129 positive calls match label 1
F1 score0.449Limited balance of precision and sensitivity
Balanced accuracy67.9%More informative here than raw accuracy
Raw accuracy69.2%Below the 80.9% majority-label baseline
Interpretation. The ROC AUC shows useful ranking information, but the 0.50 operating point misses 23 positive testing rows and generates 85 false-positive calls. The high negative-label prevalence explains why a trivial all-negative classifier has higher raw accuracy; that baseline has zero sensitivity and cannot distinguish different survival profiles.

7. Inference and reproducibility

The defensible deployment is a versioned retrospective five-year survival-stratification workflow. It can assign model scores to a research cohort, compare operating thresholds and identify groups for aggregate survival research. A patient-facing calculator would hide the 76-field data contract, assay dependencies and missing-value policy.

Versioned METABRIC-format cohort
Five-year endpoint and schema checks
76-to-95 feature encoding
Exported survival classifier
Declared research threshold
Aggregate survival-strata review

Illustrative threshold scenarios

The following values are recalculated with the exported model on the same 351 testing rows. They show how the chosen score threshold changes detection of the five-year mortality class; they are not treatment thresholds.

Retrospective policyThresholdSensitivitySpecificityFalse negativesFalse positivesPossible research purpose
Sensitivity-first review0.3088.1%48.2%8147Reduce missed labelled cases at the cost of extensive review
Nearest ROC corner0.4379.1%62.0%14108Best internal sensitivity/specificity balance on this curve
Specificity-first review0.7043.3%84.5%3844Fewer false flags, with many more missed positives
Not clinical thresholds. The operating points were examined on the internal testing set, the score is uncalibrated and no decision-curve or outcome-impact analysis is available.

Run the final model in Python

The package includes the executable 95-input model, ordered schema, raw-row encoder and batch scorer. It does not include patient-level data.

python score_csv.py 5_years_mortality.csv scored_rows.csv --threshold 0.50

Reproduce the calculation

The encoder applies the selected categorical expansion and stored mean replacement for missing numeric or binary values. The downloadable dataset retains all candidate predictors, while the package selects the final 76 raw fields in the required order.

8. Validity, uncertainty and limitations

  • Fixed-horizon endpoint documentation. The example is a valid binary survival formulation only if every label 0 row was known to survive beyond five years. Survival time, vital-status timing and censoring are not retained in the derivative table, so that rule cannot be rechecked here.
  • Prediction time is undefined. Surgery type and systemic treatment variables are retained in the final model. Their availability and meaning depend on whether the intended prediction occurs at diagnosis, after surgery or after treatment assignment.
  • Random internal split only. The 1,053/351/351 partition samples one derived cohort; there is no temporal, geographic or external-centre evaluation.
  • Input selection is optimistic unless nested. The same selection subset guides the 76-variable search. Stability across repeated grouped resampling is not reported.
  • No calibration evidence. AUC measures ranking, not agreement between scores and five-year event frequencies. Calibration-in-the-large, slope, plots and recalibration are missing.
  • High-dimensional assay dependence. Gene-expression normalization, platform effects, batch correction, mutation calling and missingness must match the development pipeline.
  • Fixed-horizon simplification. The binary endpoint answers one five-year question but discards when the event occurred, survival beyond that horizon, cause of death and competing risks. Historical treatments may also differ from current practice.
  • Subgroup performance is untested. Aggregate discrimination does not establish comparable performance across age, receptor status, stage, molecular subtype, cohort or demographic groups.
  • No clinical-utility evaluation. There is no comparison with established prognostic models, decision-curve analysis, prospective workflow study or evidence of improved patient outcomes.
Decision boundary. Use this example for software education and retrospective methods research only. Do not use its score for diagnosis, treatment decisions, follow-up scheduling or individual prognosis.

From fixed-horizon to full survival modelling

The present classifier is appropriate for demonstrating a single five-year endpoint. A more complete study would define the index date, retain event and censoring times, compare the classifier with a time-to-event survival model, freeze predictors to those available at the index date, assess calibration and clinical net benefit, and perform temporal plus external-centre validation under TRIPOD+AI and PROBAST+AI.

References