Classify the source-derived CIN II-or-worse endpoint
This reproducible Neural Designer example reformulates 197 cervical-pathology records as a binary classification problem instead of assigning arbitrary numbers to lesion grades. On 39 internally held-out records, the selected model reaches ROC AUC 0.756 and 76.0% sensitivity at score 0.50. Limited provenance, possible endpoint leakage and the absence of external validation keep it firmly within retrospective research.
1. Clinical question and intended use
The model learns the binary endpoint cin2_or_worse from age, cytology, HPV group, biopsy result, p16/Ki-67 and smoking status. The defensible purpose is to demonstrate categorical preprocessing, class-weighted training, model selection and internal validation on a small historical table.
This is not a longitudinal prognosis model: the source does not document an index date, prediction horizon or later outcome. The revised endpoint describes the record’s final source label and is therefore presented as retrospective classification.
Preserve categories
Use categorical expansion instead of imposing a questionable numeric distance between cytology, HPV and biopsy labels.
Audit an operating point
Report counts, sensitivity and specificity at a fixed score threshold rather than a goodness-of-fit chart for an ordinal regression.
Expose evidence limits
Compare the network with transparent baselines and separate reproducibility from clinical validity.
2. Cohort, measurements and endpoint
The updated cervixcancer.csv contains 197 records. The previous numeric grades have been replaced by explicit categories, and the former continuous target has been derived as cin2_or_worse: 0 for negative/CIN I and 1 for CIN II, CIN II–III, CIN III or carcinoma.
| CSV field | Role | Values and interpretation |
|---|---|---|
patient_id | Identifier | Stable row identifier; excluded from modelling. |
age | Input | Age in years, 20–68. |
cytology | Input | Normal, ASC-US, ASC-H, LSIL, HSIL, AGC or unknown. |
hpv_risk_group | Input | Negative, other low risk, other high risk, HPV 16/18 or unknown. |
biopsy_result | Input | Negative/nondiagnostic, CIN I, CIN II, CIN II–III, CIN III, carcinoma or unknown. The source numeric table had already merged negative and nondiagnostic values, so they cannot be separated retrospectively. |
p16_ki67 | Input | Negative, positive or unknown. |
smoking_status | Input | No, yes or unknown. |
cin2_or_worse | Target | Binary source-derived endpoint: 85 negative/CIN I and 112 CIN II-or-worse records. |
Missing source values remain explicit unknown categories rather than being silently imputed. Before recoding, missingness affected 5 cytology, 2 HPV, 3 biopsy, 78 p16/Ki-67 and 103 smoking entries. In particular, high missingness may reflect the local testing workflow rather than biology.
| Subset | Rows | Endpoint 0 | Endpoint 1 | Purpose |
|---|---|---|---|---|
| Training | 119 | 49 | 70 | Estimate model parameters |
| Selection | 39 | 22 | 17 | Select hidden-layer size |
| Testing | 39 | 14 | 25 | Internal final analysis |
| Total | 197 | 85 | 112 | Random 60/20/20 row split |


3. Model
Age remains numeric. Neural Designer one-hot expands the five categorical variables, producing 26 model features. The initial architecture connects those 26 scaled features directly to one sigmoid output, so it is a compact linear baseline in the expanded feature space.
cin2_or_worse=1 label. It has not been calibrated as an individual clinical probability.
4. Training strategy
The initial model minimizes weighted squared error with quasi-Newton optimization, L2 regularization 0.01 and class weights 1.1588 for endpoint 0 and 0.8795 for endpoint 1. Weighting prevents the larger class from dominating the loss.
Across 35 stored iterations, training error decreases from 1.0178 to 0.3580 and selection error from 1.1765 to 0.8203. Optimization stops on minimum loss decrease.

5. Model selection and baseline
A growing-neurons experiment evaluates hidden layers from one to ten neurons with three trials per size. The minimum stored selection error occurs at seven tanh neurons: training error 0.1445 and selection error 0.6884.

Selected architecture
The final 26–7–1 network contains 197 trainable parameters and is the model used for testing and deployment.

| Testing reference at score 0.50 | Sensitivity | Specificity | Accuracy | Balanced accuracy |
|---|---|---|---|---|
| Always predict endpoint 1 | 100.0% | 0% | 64.1% | 50.0% |
| Positive when biopsy is CIN II+ | 84.0% | 64.3% | 76.9% | 74.1% |
| Selected neural network | 76.0% | 64.3% | 71.8% | 70.1% |
The transparent biopsy rule slightly outperforms the selected network on this small test subset. The network therefore demonstrates a reproducible modelling workflow, but it does not establish incremental clinical value.
6. Clinical validation
The selected model is evaluated on 39 held-out records containing 25 positive and 14 negative source labels. Neural Designer reports ROC AUC 0.756 with a 95% confidence interval of 0.629–0.883, indicating moderate internal discrimination with substantial uncertainty.

Operating point at score 0.50
The fixed threshold produces 19 true positives, six false negatives, five false positives and nine true negatives.
| Actual / predicted | Endpoint 1 | Endpoint 0 | Total |
|---|---|---|---|
| CIN II or worse | 19 | 6 | 25 |
| Negative or CIN I | 5 | 9 | 14 |
| Total | 24 | 15 | 39 |
| Testing metric | Value | Count-based interpretation |
|---|---|---|
| Sensitivity | 76.0% | 19 of 25 endpoint-1 labels detected |
| Specificity | 64.3% | 9 of 14 endpoint-0 labels rejected |
| Precision / observed PPV | 79.2% | 19 of 24 positive calls match the source label |
| Observed NPV | 60.0% | 9 of 15 negative calls match the source label |
| Accuracy | 71.8% | 28 of 39 records classified correctly |
| Balanced accuracy | 70.1% | Mean of sensitivity and specificity |
| F1 score | 0.776 | Summary of precision and sensitivity |
7. Workflow and reproducibility
A responsible use of the artifact is a reproducibility workflow:
The calculator reproduces the final exported network for one complete source row. It deliberately returns a neutral score rather than a diagnosis or management recommendation.
Reproduce one exported model score
The default row is a complete source record used only to verify deployment. The calculation runs locally with the selected network’s exact preprocessing and coefficients.
Reproduce the calculation
The Python package contains the selected model, exact input order, categorical encoder and reference call. Neural Designer’s original generated code reused identifiers such as unknown and negative across fields; the downloadable reproducibility copy stores coefficients positionally to prevent category-name collisions while preserving the exact parameters.
from model import NeuralNetwork
score = NeuralNetwork().calculate_from_categories(
46, "lsil", "hpv_16_or_18", "cin_2_3", "positive", "yes"
)
# 0.78806221458. Safety, generalizability and governance
- No longitudinal endpoint. There is no documented index date, follow-up interval or later outcome, so this is not a prognosis or progression model.
- Possible endpoint circularity. Biopsy is both an input and closely related to the derived lesion-grade target. Without timing and adjudication metadata, it may encode part of the reference standard rather than an upstream predictor.
- Small, local sample. Only 197 records from one reported health area are available, with 39 testing rows and no external institution.
- Missingness may encode care. p16/Ki-67 and smoking are unknown in 39.6% and 52.3% of records. The unknown category can reflect which tests were ordered or recorded.
- Duplicate leakage. Two testing input vectors occur in training; a grouped or temporal resplit is required.
- No calibration or subgroup analysis. Scores are not calibrated, and performance by age, HPV group or other clinically relevant strata is not established.
- No demonstrated added value. On this test subset, a simple biopsy rule slightly exceeds the neural network’s balanced accuracy.
References
- Original Neural Designer example and stated Palencia data provenance.
- WHO guideline for screening and treatment of cervical pre-cancer lesions for cervical cancer prevention, second edition.
- WHO guideline on HPV DNA genotyping in cervical screening programmes.
- Castilla y León cervical cancer prevention and early-detection programme.




