{"id":3475,"date":"2025-09-03T11:12:59","date_gmt":"2025-09-03T09:12:59","guid":{"rendered":"https:\/\/neuraldesigner.com\/learning\/colon-cancer-liver-metastasis\/"},"modified":"2026-08-10T10:14:56","modified_gmt":"2026-08-10T08:14:56","slug":"metastasis-prediction-machine-learning","status":"publish","type":"learning","link":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/","title":{"rendered":"Metastasis prediction using machine learning"},"content":{"rendered":"<style>\n.nds{--nds-code-bg:#f3f7fa;--nds-code-fg:#12354b;width:100vw;margin-left:calc(50% - 50vw);padding:22px 24px 14px;background:#eee;color:#1b2635;font-family:\"Outfit\",\"Roboto\",Arial,sans-serif}\n.nds *{box-sizing:border-box}.nds-wrap{width:min(100%,1200px);margin:0 auto}.nds a{text-decoration:none;color:#2d799f}\n.nds-executive{margin:0 0 34px;padding:32px;border-radius:20px;background:linear-gradient(135deg,#12354b,#245e80);color:#fff}.nds-executive h2{margin:0 0 12px;color:#fff;font-size:30px}.nds-executive p{font-size:18px;line-height:1.55}\n.nds-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-top:22px}.nds-kpi{padding:18px;border:1px solid rgba(255,255,255,.18);border-radius:14px;background:rgba(255,255,255,.1)}.nds-kpi strong{display:block;font-size:25px}.nds-kpi span{font-size:13px}\n.nds-actions,.nds-audience,.nds-downloads{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin:22px 0}.nds-actions a,.nds-downloads a{padding:12px 20px;border-radius:24px;background:#245e80;color:#fff;font-weight:700}.nds-executive .nds-actions a{background:#fff;color:#12354b}\n.nds-toc{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin:0 0 42px;padding:0;list-style:none}.nds-toc a,.nds-audience span{display:block;padding:9px 14px;border-radius:20px;background:#e9f2f8;color:#12354b;font-weight:600}\n.nds-card{margin:0 0 54px;scroll-margin-top:90px}.nds-card h2{margin:0 0 20px;padding-bottom:12px;border-bottom:1px solid #dbe5ec;color:#001233;font-size:24px}.nds-card p,.nds-card li{font-size:16.5px;line-height:1.6}.nds-card img{display:block;width:auto;max-width:min(640px,100%);height:auto;margin:24px auto;border-radius:12px}.nds-card img.nds-architecture{width:min(1000px,100%);max-width:100%}\n.nds-value-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:22px 0}.nds-value{padding:20px;border:1px solid #dce8ef;border-radius:14px;background:#f8fbfd}.nds-note{margin:20px 0;padding:18px 20px;border-left:4px solid #56a1c8;border-radius:0 12px 12px 0;background:#f6fafc}.nds-note--warning{border-left-color:#d79a29;background:#fff9ed}\n.nds-table-scroll{max-width:100%;overflow-x:auto}.nds-card table{width:auto;max-width:100%;margin:24px auto;border-collapse:collapse;background:#fff}.nds-card th,.nds-card td{padding:11px 16px;border-bottom:1px solid #e2e9ee}.nds-card thead th{background:#12354b!important;color:#fff!important}.nds-card tbody th{background:#eaf2f6!important;color:#12354b!important;text-align:left}.nds-card tbody tr:nth-child(even) th{background:#f4f8fa!important}.nds-card tbody td{color:#33424f!important}\n.nds-figure-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.nds-figure-grid figure,.nds-architecture-figure{margin:0;padding:16px;border:1px solid #dce8ef;border-radius:15px;background:#f8fbfd}.nds-figure-grid img{width:100%;max-width:100%;margin:0 auto 12px}.nds-card figcaption{color:#405361;font-size:14px;line-height:1.45}\n.nds pre,.nds .wp-block-code,.nds pre[class*=\"language-\"]{display:block;max-width:100%;overflow:auto;padding:18px 20px!important;border:1px solid #d5e2e9!important;border-radius:12px!important;background:var(--nds-code-bg)!important;color:var(--nds-code-fg)!important;box-shadow:none!important;text-shadow:none!important;white-space:pre}\n.nds pre code,.nds pre code *,.nds .wp-block-code code,.nds .wp-block-code code *{border:0!important;background:transparent!important;color:var(--nds-code-fg)!important;box-shadow:none!important;text-shadow:none!important;font-family:Consolas,\"Liberation Mono\",monospace!important;font-size:14px;line-height:1.55}\n.nds :not(pre)>code{padding:.08em .32em;border-radius:4px;background:#e6eef3!important;color:#12354b!important}\n.nds .nds-expression{max-width:100%;overflow:auto;margin:22px auto;padding:18px 20px;border:1px solid #d5e2e9;border-radius:12px;background:#fff!important;color:#12354b!important;text-align:center}\n.nds .nds-expression math,.nds .nds-expression mjx-container,.nds .nds-expression .MathJax{background:transparent!important;color:#12354b!important}\n@media(max-width:820px){.nds-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.nds-value-grid{grid-template-columns:1fr}}\n@media(max-width:620px){.nds{padding:12px 14px}.nds-kpis,.nds-figure-grid{grid-template-columns:1fr}.nds-executive{padding:24px 20px}.nds-card table{font-size:13px}.nds-card th,.nds-card td{padding:9px 8px}}\n<\/style>\n<style>\n.nds-centered-figure{max-width:820px;margin:24px auto!important;padding:16px;border:1px solid #dce8ef;border-radius:15px;background:#f8fbfd}\n.nds-centered-figure img{display:block;width:100%;max-width:100%;margin:0 auto 12px}\n.nds-roc-figure{max-width:610px;margin:24px auto!important;padding:16px;border:1px solid #dce8ef;border-radius:15px;background:#f8fbfd}\n.nds-roc-figure img{display:block;width:min(540px,100%);max-width:100%;margin:0 auto 12px}\n.nds-validation-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;align-items:start}\n.nds-validation-grid table{margin-top:0}.nds-confusion td,.nds-metrics td:nth-child(2){text-align:right;font-variant-numeric:tabular-nums}\n.nds-flow{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin:24px 0}\n.nds-flow div{position:relative;display:flex;min-height:100px;align-items:center;justify-content:center;padding:13px 9px;border-radius:13px;background:#12354b;color:#fff;text-align:center;font-weight:700}\n.nds-flow div:not(:last-child):after{content:\"\u2192\";position:absolute;right:-15px;top:50%;z-index:2;transform:translateY(-50%);color:#56a1c8;font-size:21px}\n@media(max-width:960px){.nds-validation-grid{grid-template-columns:1fr}.nds-flow{grid-template-columns:repeat(3,1fr)}.nds-flow div:after{display:none}}\n@media(max-width:760px){.nds-flow{grid-template-columns:1fr}.nds-flow div:after{display:none}}\n<\/style>\n<div class=\"nds\" data-science-profile=\"life-health\">\n<div class=\"nds-wrap\">\n<section class=\"nds-executive\">\n<h2>Classify liver-metastasis status in a retrospective colorectal cancer cohort<\/h2>\n<p>A Neural Designer network combines clinical, tumour and targeted-sequencing descriptors from a filtered MSK-MET table. On 707 internally held-out rows it reaches ROC AUC 0.856 and 78.4% accuracy. Because several inputs describe metastatic burden or later outcomes, this is a retrospective research classifier\u2014not an early-risk, diagnostic or treatment model.<\/p>\n<div class=\"nds-kpis\">\n<div class=\"nds-kpi\"><strong>0.856<\/strong><span>testing ROC AUC (95% CI 0.833\u20130.878)<\/span><\/div>\n<div class=\"nds-kpi\"><strong>78.4%<\/strong><span>testing accuracy at threshold 0.50<\/span><\/div>\n<div class=\"nds-kpi\"><strong>3,537<\/strong><span>unique sample rows<\/span><\/div>\n<div class=\"nds-kpi\"><strong>525\u20137\u20131<\/strong><span>final encoded network<\/span><\/div>\n<\/div>\n<div class=\"nds-actions\"><a href=\"#6-validation\">Review the testing evidence<\/a><a href=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/10\/liver_metastasis_colon_cancer.csv\">Download the data<\/a><\/div>\n<\/section>\n<ul class=\"nds-toc\">\n<li><a href=\"#1-scientific-objective\">Scientific objective<\/a><\/li>\n<li><a href=\"#2-data-provenance\">Data and provenance<\/a><\/li>\n<li><a href=\"#3-model\">Model<\/a><\/li>\n<li><a href=\"#4-training\">Training<\/a><\/li>\n<li><a href=\"#5-selection\">Selection<\/a><\/li>\n<li><a href=\"#6-validation\">Validation<\/a><\/li>\n<li><a href=\"#7-inference\">Inference<\/a><\/li>\n<li><a href=\"#8-validity\">Validity<\/a><\/li>\n<\/ul>\n<section id=\"1-scientific-objective\" class=\"nds-card\">\n<h2>1. Scientific objective<\/h2>\n<p>The target records whether a colorectal cancer sample is labelled with distant liver metastasis in the derived table. The defensible objective is to reproduce associations and classify this recorded status inside the available cohort. It is not to forecast which metastasis-free patient will later develop liver disease.<\/p>\n<div class=\"nds-value-grid\">\n<div class=\"nds-value\">\n<h3>Retrospective phenotyping<\/h3>\n<p>Prioritize or quality-check cohort rows using a reproducible multivariable score.<\/p>\n<\/div>\n<div class=\"nds-value\">\n<h3>Organotropism research<\/h3>\n<p>Study how clinical burden and genomic descriptors co-vary with recorded liver involvement.<\/p>\n<\/div>\n<div class=\"nds-value\">\n<h3>Reproducible benchmarking<\/h3>\n<p>Inspect the split, preprocessing, selected architecture, exact weights and operating thresholds.<\/p>\n<\/div>\n<\/div>\n<div class=\"nds-audience\">\n<span>Computational oncology<\/span><span>Cancer genomics<\/span><span>Biostatistics<\/span><span>Translational research<\/span><span>Clinical data science<\/span>\n<\/div>\n<div class=\"nds-note\"><strong>Scope.<\/strong> The model is an internally evaluated research example derived from one institutional cohort. It does not establish temporal prediction, clinical utility, calibration in another population or benefit to patients.<\/div>\n<\/section>\n<section id=\"2-data-provenance\" class=\"nds-card\">\n<h2>2. Data and provenance<\/h2>\n<p>The table contains 3,537 unique sample identifiers from colorectal cancer records derived from the public MSK-MET study. It has 510 columns: one identifier, 492 mutation-count fields, 16 other clinical or tumour descriptors and the binary target <code>distant_metastasis_liver<\/code>.<\/p>\n<div class=\"nds-table-scroll\">\n<table>\n<thead>\n<tr>\n<th>Subset<\/th>\n<th>Rows<\/th>\n<th>Liver metastasis: Yes<\/th>\n<th>No<\/th>\n<th>Purpose<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Training<\/th>\n<td>2,123<\/td>\n<td>1,185<\/td>\n<td>938<\/td>\n<td>Estimate model parameters<\/td>\n<\/tr>\n<tr>\n<th>Selection<\/th>\n<td>707<\/td>\n<td>396<\/td>\n<td>311<\/td>\n<td>Choose the hidden-layer size<\/td>\n<\/tr>\n<tr>\n<th>Testing<\/th>\n<td>707<\/td>\n<td>437<\/td>\n<td>270<\/td>\n<td>Final internal evaluation<\/td>\n<\/tr>\n<tr>\n<th>Total<\/th>\n<td>3,537<\/td>\n<td>2,018 (57.1%)<\/td>\n<td>1,519 (42.9%)<\/td>\n<td>Derived analysis cohort<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"nds-figure-grid\">\n<figure><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-target-distribution-2026.png\" alt=\"Distribution of liver-metastasis yes and no labels\"><figcaption>The target is moderately imbalanced: 57.1% of rows carry the liver-metastasis label.<\/figcaption><\/figure>\n<figure><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-input-target-correlations-2026.png\" alt=\"Largest univariate correlations with the liver-metastasis label\"><figcaption>The two largest associations are metastatic-burden variables. These coefficients are descriptive, not causal importance estimates or prospective biomarkers.<\/figcaption><\/figure>\n<\/div>\n<h3>Model input contract<\/h3>\n<p>Eleven mutation fields are constant in this subset and are marked unused. The remaining 497 raw inputs comprise 481 mutation counts and 16 clinical or tumour fields. Categorical expansion produces 525 numeric model features. The source CSV uses <code>NA<\/code> in five fields; the downloadable converter reproduces the project&#8217;s numeric mean imputation and categorical missing-value encoding.<\/p>\n<div class=\"nds-note nds-note--warning\"><strong>Temporal leakage boundary.<\/strong> <code>metastasis_count<\/code>, <code>metastasis_primary_site_count<\/code>, <code>age_at_first_metastasis_diagnostic<\/code> and <code>mortality_3_years<\/code> are not clean baseline predictors for a pre-metastasis decision. Their inclusion makes the endpoint contemporaneous or retrospective.<\/div>\n<div class=\"nds-note nds-note--provenance\"><strong>Provenance.<\/strong> The source is the MSK-MET clinico-genomic resource reported by Nguyen et al. The full study contains more than 25,000 patients across 50 cancer types; this tutorial uses a filtered 3,537-row colorectal table and must not be described as validation on the full cohort.<\/div>\n<\/section>\n<section id=\"3-model\" class=\"nds-card\">\n<h2>3. Model<\/h2>\n<p>The starting classifier scales 525 numeric features created from 497 raw inputs and connects them directly to one sigmoid output. With no hidden layer, the initial model contains 526 trainable parameters and provides the baseline for training and hidden-neuron selection.<\/p>\n<div class=\"nds-note\"><strong>Output contract.<\/strong> Larger scores rank rows toward the supplied <code>Yes<\/code> label. The sigmoid score has not been independently calibrated as an individual probability of liver metastasis.<\/div>\n<figure class=\"nds-architecture-figure\" data-model-stage=\"initial\"><img decoding=\"async\" class=\"nds-architecture\" src=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-initial-network-2026.png\" alt=\"Initial liver-metastasis classifier with 497 raw inputs, 525 encoded features and one output\"><figcaption>Initial direct 525\u20131 encoded architecture used before growing-neurons selection.<\/figcaption><\/figure>\n<\/section>\n<section id=\"4-training\" class=\"nds-card\">\n<h2>4. Training strategy<\/h2>\n<p>The stored training strategy minimizes class-weighted squared error with the quasi-Newton method and L2 regularization weight 0.01. The positive and negative class weights are 0.8764 and 1.1643, respectively.<\/p>\n<p>Training error falls from 1.112 to 0.439 in the displayed run. Selection error reaches its lowest region early\u2014about 0.664\u2014and then increases to roughly 0.747 while training loss continues to decline. This is evidence of overfitting in the initial run; it is not \u201cstrong generalization.\u201d<\/p>\n<figure class=\"nds-centered-figure\"><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-training-history-2026.png\" alt=\"Training and selection errors for the initial liver-metastasis network\"><figcaption>The divergence between training and selection errors motivates capacity control and independent testing.<\/figcaption><\/figure>\n<\/section>\n<section id=\"5-selection\" class=\"nds-card\">\n<h2>5. Model selection and baseline<\/h2>\n<p>Growing-neurons selection evaluates one to ten hidden tanh neurons with three trials per size. The reported minimum selection error is 0.6297 at seven neurons, with training error 0.1301.<\/p>\n<figure class=\"nds-centered-figure\"><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-neuron-selection-2026.png\" alt=\"Liver-metastasis training and selection errors by hidden-neuron count\"><figcaption>Selection error is nearly flat across the search (approximately 0.630\u20130.646), so seven neurons are the stored choice, not evidence of a uniquely superior architecture.<\/figcaption><\/figure>\n<h3>Selected architecture<\/h3>\n<p>The final model expands the hidden layer to seven tanh neurons and retains one sigmoid output. The encoded 525\u20137\u20131 network contains 3,690 trainable parameters and is the version used for the ROC curve, confusion analysis and Python export.<\/p>\n<figure class=\"nds-architecture-figure\" data-model-stage=\"selected\"><img decoding=\"async\" class=\"nds-architecture\" src=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-selected-network-2026.png\" alt=\"Selected liver-metastasis network with 525 encoded inputs, seven hidden neurons and one output\"><figcaption>Final 525\u20137\u20131 architecture obtained after growing-neurons selection.<\/figcaption><\/figure>\n<div class=\"nds-table-scroll\">\n<table>\n<thead>\n<tr>\n<th>Reference<\/th>\n<th>Testing accuracy<\/th>\n<th>Interpretation<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Majority-class baseline<\/th>\n<td>61.8%<\/td>\n<td>Label every testing row as liver-metastasis positive<\/td>\n<\/tr>\n<tr>\n<th>Final neural network<\/th>\n<td>78.4%<\/td>\n<td>16.6 percentage points above the internal baseline<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/section>\n<section id=\"6-validation\" class=\"nds-card\">\n<h2>6. Scientific validation<\/h2>\n<p>Final performance is calculated once on the 707 testing rows. Neural Designer reports ROC AUC 0.856 with a 95% confidence interval of 0.833\u20130.878. The regenerated ROC graphic marks threshold 0.51, the testing point nearest the upper-left corner.<\/p>\n<figure class=\"nds-roc-figure\"><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-roc-curve-2026.png\" alt=\"ROC curve for the 707 liver-metastasis testing rows\"><figcaption>Testing ROC curve. The marked point is selected from this internal test curve and is descriptive; it is not an externally validated clinical cutoff.<\/figcaption><\/figure>\n<div class=\"nds-validation-grid\">\n<div class=\"nds-table-scroll\">\n<table class=\"nds-confusion\">\n<thead>\n<tr>\n<th>Actual \/ predicted at 0.50<\/th>\n<th>Positive<\/th>\n<th>Negative<\/th>\n<th>Total<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Liver metastasis: Yes<\/th>\n<td>344<\/td>\n<td>93<\/td>\n<td>437<\/td>\n<\/tr>\n<tr>\n<th>Liver metastasis: No<\/th>\n<td>60<\/td>\n<td>210<\/td>\n<td>270<\/td>\n<\/tr>\n<tr>\n<th>Total<\/th>\n<td>404<\/td>\n<td>303<\/td>\n<td>707<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"nds-table-scroll\">\n<table class=\"nds-metrics\">\n<thead>\n<tr>\n<th>Testing metric<\/th>\n<th>Value<\/th>\n<th>Reading<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Accuracy<\/th>\n<td>78.4%<\/td>\n<td>554 of 707 rows are classified correctly<\/td>\n<\/tr>\n<tr>\n<th>Precision<\/th>\n<td>85.1%<\/td>\n<td>344 of 404 positive calls match the supplied label<\/td>\n<\/tr>\n<tr>\n<th>Sensitivity<\/th>\n<td>78.7%<\/td>\n<td>344 of 437 labelled positives are detected<\/td>\n<\/tr>\n<tr>\n<th>Specificity<\/th>\n<td>77.8%<\/td>\n<td>210 of 270 labelled negatives are rejected<\/td>\n<\/tr>\n<tr>\n<th>F1 score<\/th>\n<td>0.818<\/td>\n<td>Harmonic balance of precision and sensitivity<\/td>\n<\/tr>\n<tr>\n<th>Balanced accuracy<\/th>\n<td>78.2%<\/td>\n<td>Mean of sensitivity and specificity<\/td>\n<\/tr>\n<tr>\n<th>ROC AUC<\/th>\n<td>0.856<\/td>\n<td>Ranking discrimination across all thresholds<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<div class=\"nds-figure-grid\"><\/div>\n<div class=\"nds-note\"><strong>Interpretation.<\/strong> The network discriminates the recorded endpoint better than the majority baseline, but 93 testing positives are missed and 60 negatives are flagged at 0.50. Accuracy and AUC do not establish calibration, net benefit, temporal validity or clinical utility.<\/div>\n<\/section>\n<section id=\"7-inference\" class=\"nds-card\">\n<h2>7. Inference and reproducibility<\/h2>\n<p>The appropriate deployment for this example is a reproducible batch-research workflow, not a patient-facing calculator. Manual entry of 497 raw variables would be error-prone, and the endpoint is not defined for prospective clinical use.<\/p>\n<div class=\"nds-flow\">\n<div>Versioned MSK-MET-format extract<\/div>\n<div>Schema and category checks<\/div>\n<div>497-to-525 encoding<\/div>\n<div>525\u20137\u20131 exported network<\/div>\n<div>Score and declared threshold<\/div>\n<div>Aggregate research report and expert review<\/div>\n<\/div>\n<h3>Illustrative threshold policies<\/h3>\n<p>These scenarios are recalculated from the 707 testing rows with the exact Python export. They demonstrate the trade-off only; a real operating point requires a prespecified use case and separate external evaluation.<\/p>\n<div class=\"nds-table-scroll\">\n<table>\n<thead>\n<tr>\n<th>Retrospective policy<\/th>\n<th>Threshold<\/th>\n<th>Sensitivity<\/th>\n<th>Specificity<\/th>\n<th>False negatives<\/th>\n<th>False positives<\/th>\n<th>Research use<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Sensitivity-first review<\/th>\n<td>0.30<\/td>\n<td>87.6%<\/td>\n<td>62.6%<\/td>\n<td>54<\/td>\n<td>101<\/td>\n<td>Reduce missed labelled rows at the cost of more manual review<\/td>\n<\/tr>\n<tr>\n<th>Nearest ROC corner<\/th>\n<td>0.51<\/td>\n<td>78.5%<\/td>\n<td>78.9%<\/td>\n<td>94<\/td>\n<td>57<\/td>\n<td>Balanced internal discrimination<\/td>\n<\/tr>\n<tr>\n<th>Specificity-first review<\/th>\n<td>0.70<\/td>\n<td>65.7%<\/td>\n<td>85.9%<\/td>\n<td>150<\/td>\n<td>38<\/td>\n<td>Fewer false flags, substantially more missed positives<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"nds-note nds-note--warning\"><strong>Not clinical thresholds.<\/strong> All three rows reuse the same internal testing set. They are unsuitable for diagnosis, surveillance intervals, treatment selection or patient counselling.<\/div>\n<h3>Run the exact model in Python<\/h3>\n<p>The package accepts the raw semicolon-delimited table, reproduces the project&#8217;s categorical expansion and missing-value handling, and appends a score and threshold label to every row. It contains the model definition and schema, but no patient-level records.<\/p>\n<pre><code>python score_csv.py liver_metastasis.csv scored_rows.csv --threshold 0.50<\/code><\/pre>\n<h3>Reproduce the calculation<\/h3>\n<p>The Python ZIP contains the exact exported weights, a 525-feature schema, the validated raw-to-feature converter and a batch scoring script. The patient-level dataset is not duplicated inside the package.<\/p>\n<div class=\"nds-downloads\"><a href=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2026\/08\/liver-metastasis-python-model-2026.zip\">Download Python model (ZIP)<\/a><a href=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/10\/liver_metastasis_colon_cancer.csv\" download>Download the existing research dataset (CSV)<\/a><\/div>\n<\/section>\n<section id=\"8-validity\" class=\"nds-card\">\n<h2>8. Validity, uncertainty and limitations<\/h2>\n<ul>\n<li><strong>Retrospective endpoint.<\/strong> The label records known liver involvement. Several inputs describe metastatic burden or later outcomes, so the model does not answer a clean pre-metastasis prediction question.<\/li>\n<li><strong>No declared index date.<\/strong> Predictor availability is not frozen at a common clinical decision point. A prospective version must define time zero and retain only information available then.<\/li>\n<li><strong>Internal random split only.<\/strong> The 2,123\/707\/707 partition evaluates rows from the same derived institutional cohort. There is no temporal, geographic or external-centre validation.<\/li>\n<li><strong>Selection uncertainty.<\/strong> Hidden-layer selection errors are nearly flat, and architecture choice is based on one selection split. Repeated grouped resampling is needed to quantify stability.<\/li>\n<li><strong>Calibration unverified.<\/strong> The sigmoid score is useful for ranking and threshold demonstrations, but no calibration curve, calibration slope\/intercept or external recalibration is reported.<\/li>\n<li><strong>Prevalence dependence.<\/strong> The testing prevalence is 61.8%; precision and negative predictive value will change in populations with different case mix and endpoint ascertainment.<\/li>\n<li><strong>Feature and coding drift.<\/strong> Sequencing panel versions, variant processing, tumour purity, missingness and category definitions must remain compatible with the training pipeline.<\/li>\n<li><strong>Equity and subgroup performance untested.<\/strong> Aggregate results do not establish comparable performance by sex, race category, age, primary site or molecular subtype.<\/li>\n<li><strong>No clinical-impact evaluation.<\/strong> There is no decision-curve analysis, prospective workflow study, comparison with standard care or evidence that model use improves outcomes.<\/li>\n<\/ul>\n<div class=\"nds-note nds-note--warning\"><strong>Decision boundary.<\/strong> Use this package for education, reproducibility and retrospective cohort research. Do not use it to diagnose liver metastasis, set surveillance schedules, select therapy or advise an individual patient.<\/div>\n<h3>What a prospective redevelopment would require<\/h3>\n<p>Define a baseline decision time; exclude downstream variables such as known metastatic counts and three-year mortality; specify eligible patients and outcome ascertainment; validate by patient, time and external centre; assess calibration and clinical utility; and report the study using TRIPOD+AI with risk of bias assessed using PROBAST+AI.<\/p>\n<\/section>\n<section id=\"references\" class=\"nds-card\">\n<h2>References<\/h2>\n<ul>\n<li>Nguyen B, Fong C, Luthra A, et al. <a href=\"https:\/\/doi.org\/10.1016\/j.cell.2022.01.003\">Genomic characterization of metastatic patterns from prospective clinical sequencing of 25,000 patients<\/a>. <em>Cell<\/em>. 2022;185(3):563\u2013575.e11.<\/li>\n<li><a href=\"https:\/\/www.cbioportal.org\/study\/summary?id=msk_met_2021\">MSK MetTropism (MSK-MET) study<\/a>. cBioPortal for Cancer Genomics.<\/li>\n<li>Collins GS, Moons KGM, Dhiman P, et al. <a href=\"https:\/\/doi.org\/10.1136\/bmj-2023-078378\">TRIPOD+AI statement<\/a>. <em>BMJ<\/em>. 2024;385:e078378.<\/li>\n<li>Moons KGM, Damen JAAG, Kaul T, et al. <a href=\"https:\/\/doi.org\/10.1136\/bmj-2024-082505\">PROBAST+AI<\/a>. <em>BMJ<\/em>. 2025;388:e082505.<\/li>\n<\/ul>\n<\/section>\n<\/div>\n<\/div>\n","protected":false},"author":19,"featured_media":1984,"template":"","categories":[29],"tags":[38],"class_list":["post-3475","learning","type-learning","status-publish","has-post-thumbnail","hentry","category-examples","tag-healthcare"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Metastasis prediction using machine learning<\/title>\n<meta name=\"description\" content=\"Build a machine learning model to assess colorectal cancer patients&#039; risk of liver metastasis using clinical and mutational data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Colon cancer liver metastasis machine learning example\" \/>\n<meta property=\"og:description\" content=\"This example aims to assess the probability to suffer liver metastasis in colorectal patients from mutational data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/\" \/>\n<meta property=\"og:site_name\" content=\"Neural Designer\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-10T08:14:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Colon cancer liver metastasis machine learning example\" \/>\n<meta name=\"twitter:description\" content=\"This example aims to assess the probability to suffer liver metastasis in colorectal patients from mutational data.\" \/>\n<meta name=\"twitter:site\" content=\"@NeuralDesigner\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/\",\"name\":\"Metastasis prediction using machine learning\",\"isPartOf\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp\",\"datePublished\":\"2025-09-03T09:12:59+00:00\",\"dateModified\":\"2026-08-10T08:14:56+00:00\",\"description\":\"Build a machine learning model to assess colorectal cancer patients' risk of liver metastasis using clinical and mutational data.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#primaryimage\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp\",\"width\":1200,\"height\":628,\"caption\":\"Liver metastasis gene mutations\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.neuraldesigner.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learning\",\"item\":\"https:\/\/www.neuraldesigner.com\/learning\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Metastasis prediction using machine learning\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"name\":\"Neural Designer\",\"description\":\"Explainable AI Platform\",\"publisher\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.neuraldesigner.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\",\"name\":\"Neural Designer\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"width\":1024,\"height\":223,\"caption\":\"Neural Designer\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/NeuralDesigner\",\"https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Metastasis prediction using machine learning","description":"Build a machine learning model to assess colorectal cancer patients' risk of liver metastasis using clinical and mutational data.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/","og_locale":"en_US","og_type":"article","og_title":"Colon cancer liver metastasis machine learning example","og_description":"This example aims to assess the probability to suffer liver metastasis in colorectal patients from mutational data.","og_url":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/","og_site_name":"Neural Designer","article_modified_time":"2026-08-10T08:14:56+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_title":"Colon cancer liver metastasis machine learning example","twitter_description":"This example aims to assess the probability to suffer liver metastasis in colorectal patients from mutational data.","twitter_site":"@NeuralDesigner","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/","url":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/","name":"Metastasis prediction using machine learning","isPartOf":{"@id":"https:\/\/www.neuraldesigner.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#primaryimage"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#primaryimage"},"thumbnailUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp","datePublished":"2025-09-03T09:12:59+00:00","dateModified":"2026-08-10T08:14:56+00:00","description":"Build a machine learning model to assess colorectal cancer patients' risk of liver metastasis using clinical and mutational data.","breadcrumb":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#primaryimage","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/liver_met_mutation2.webp","width":1200,"height":628,"caption":"Liver metastasis gene mutations"},{"@type":"BreadcrumbList","@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/metastasis-prediction-machine-learning\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.neuraldesigner.com\/"},{"@type":"ListItem","position":2,"name":"Learning","item":"https:\/\/www.neuraldesigner.com\/learning\/"},{"@type":"ListItem","position":3,"name":"Metastasis prediction using machine learning"}]},{"@type":"WebSite","@id":"https:\/\/www.neuraldesigner.com\/#website","url":"https:\/\/www.neuraldesigner.com\/","name":"Neural Designer","description":"Explainable AI Platform","publisher":{"@id":"https:\/\/www.neuraldesigner.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.neuraldesigner.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.neuraldesigner.com\/#organization","name":"Neural Designer","url":"https:\/\/www.neuraldesigner.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","width":1024,"height":223,"caption":"Neural Designer"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/NeuralDesigner","https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning"}],"about":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/types\/learning"}],"author":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/users\/19"}],"version-history":[{"count":17,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3475\/revisions"}],"predecessor-version":[{"id":23205,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3475\/revisions\/23205"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media\/1984"}],"wp:attachment":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media?parent=3475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/categories?post=3475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/tags?post=3475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}