v4 update

This commit is contained in:
rpotter6298
2026-04-20 18:01:31 +02:00
parent 13290575d5
commit 4dea45df78
71 changed files with 8316 additions and 4112 deletions
@@ -0,0 +1,146 @@
{
"run_name": "v4/ensemble_fused",
"config": {
"_notes": [
"V4 ensemble_fused: img + cd towers, HTFusion Stage 1, HyperBridge Stage 2.",
"Matches phase5/embedding_mlp_head setup for direct comparison.",
"data_source resolves against the PapilaBundle returned by build_data.",
"image_dir / clinical_dir are project-relative; orchestrator resolves against REPO_ROOT."
],
"run_name": "v4/ensemble_fused",
"eval_mode": "binary",
"split_identity_level": 1,
"epochs": 30,
"fusion_epochs": 10,
"folds": 5,
"fold_seed": 100,
"seed": 1234,
"output_root": "v4/results",
"data": {
"module": "v4.classes.profiles.v4papila",
"args": {
"image_dir": "Papila/FundusImages",
"clinical_dir": "Papila/ClinicalData",
"label_col": "Diagnosis",
"iop_corr_method": "ratio",
"iop_drop_raw": true,
"exclude_cols": [
"Axial_Length"
],
"in_memory_cache": true
}
},
"towers": [
{
"name": "img",
"module": "v4.classes.towers.image_tower",
"class": "ImageEncoder",
"data_source": "image",
"args": {
"backbone": "refugelike",
"freeze_ratio": 0.0,
"augment": true
},
"warmup_epochs": 0
},
{
"name": "cd",
"module": "v4.classes.towers.clinical_tower",
"class": "ClinicalEncoder",
"data_source": "matrix",
"args": {
"hidden_dim": 128
},
"warmup_epochs": 40,
"warmup_exclude_towers": [
"img"
]
}
],
"bridge": {
"mode": "embedding_mlp",
"fusion_dim": 256,
"hidden_dim": 256
},
"training": {
"lr": 0.0001,
"batch_size": 16,
"bcd_prob": 0.5,
"warmup_tower_epochs": 3,
"warmup_fused_epochs": 3,
"tune_binary_threshold": true
}
},
"mean_val_auc": 0.9036764705882353,
"std_val_auc": 0.02318218054475656,
"mean_test_auc": 0.9007352941176471,
"std_test_auc": 0.04178903599524356,
"elapsed_s": 1563.1,
"fold_results": [
{
"fold": 0,
"val_auc": 0.9044117647058824,
"val_acc": 0.8571428571428571,
"val_n": 42,
"val_kappa": 0.42727272727272725,
"val_mcc": 0.4622975667767223,
"val_f1": 0.7083333333333333,
"val_threshold": 0.1659889668226242,
"test_auc": 0.8566176470588236,
"test_acc": 0.9285714285714286,
"test_n": 42
},
{
"fold": 1,
"val_auc": 0.8970588235294118,
"val_acc": 0.8809523809523809,
"val_n": 42,
"val_kappa": 0.5945945945945946,
"val_mcc": 0.5965587590013045,
"val_f1": 0.7971014492753623,
"val_threshold": 0.017083797603845596,
"test_auc": 0.9044117647058824,
"test_acc": 0.8095238095238095,
"test_n": 42
},
{
"fold": 2,
"val_auc": 0.863970588235294,
"val_acc": 0.8333333333333334,
"val_n": 42,
"val_kappa": 0.43243243243243246,
"val_mcc": 0.4338609156373123,
"val_f1": 0.7159420289855072,
"val_threshold": 0.09843172132968903,
"test_auc": 0.9044117647058824,
"test_acc": 0.8571428571428571,
"test_n": 42
},
{
"fold": 3,
"val_auc": 0.9227941176470588,
"val_acc": 0.8809523809523809,
"val_n": 42,
"val_kappa": 0.631578947368421,
"val_mcc": 0.6333004963811236,
"val_f1": 0.8156277436347674,
"val_threshold": 0.01531070377677679,
"test_auc": 0.8639705882352942,
"test_acc": 0.8571428571428571,
"test_n": 42
},
{
"fold": 4,
"val_auc": 0.9301470588235294,
"val_acc": 0.9047619047619048,
"val_n": 42,
"val_kappa": 0.6181818181818182,
"val_mcc": 0.6688560540599386,
"val_f1": 0.8055555555555556,
"val_threshold": 0.19587548077106476,
"test_auc": 0.9742647058823529,
"test_acc": 0.9285714285714286,
"test_n": 42
}
]
}
@@ -0,0 +1,264 @@
{
"run_name": "v4/ensemble_fused",
"eval_stage": "hb",
"config": {
"_notes": [
"V4 stage-pipeline: warm \u2192 fusion stages with parallel head stages.",
"Bridges are pure embedding producers; heads are separate swappable stages.",
"BCD-eligible heads are sampled during tower_warmup and main phases.",
"eval_stage names the fusion stage whose primary head is used for final metrics."
],
"run_name": "v4/ensemble_fused",
"num_classes": 2,
"label_filter": [
0,
1
],
"split_identity_level": 1,
"eval_stage": "hb",
"save_predictions": false,
"seed": 1234,
"folds": 5,
"fold_seed": 100,
"output_root": "v4/results",
"out_dir_tags": [
"binary",
"ntower"
],
"data": {
"module": "v4.classes.profiles.v4papila",
"args": {
"image_dir": "Papila/FundusImages",
"clinical_dir": "Papila/ClinicalData",
"label_col": "Diagnosis",
"iop_corr_method": "ratio",
"iop_drop_raw": true,
"exclude_cols": [
"Axial_Length"
],
"in_memory_cache": true
}
},
"towers": [
{
"name": "img",
"module": "v4.classes.towers.image_tower",
"class": "ImageEncoder",
"data_source": "image",
"args": {
"backbone": "refugelike",
"freeze_ratio": 0.0,
"augment": true
}
},
{
"name": "cd",
"module": "v4.classes.towers.clinical_tower",
"class": "ClinicalEncoder",
"data_source": "matrix",
"args": {
"hidden_dim": 128
}
}
],
"stages": [
{
"name": "cd_warm",
"type": "warm",
"tower": "cd",
"level": "eye",
"epochs": 40
},
{
"name": "img_aux",
"type": "head",
"input": "img",
"train_with": "nt",
"bcd": true
},
{
"name": "cd_aux",
"type": "head",
"input": "cd",
"train_with": "nt",
"bcd": true
},
{
"name": "nt",
"type": "fusion",
"module": "v4.classes.bridges.fusion_bridge",
"class": "FusionBridge",
"inputs": [
"img",
"cd"
],
"level": "eye",
"epochs": 36,
"train_towers": true,
"warmup": {
"tower_epochs": 3,
"fused_epochs": 3
},
"args": {
"fusion_dim": 256
}
},
{
"name": "nt_head",
"type": "head",
"input": "nt",
"train_with": "nt"
},
{
"name": "hb",
"type": "fusion",
"module": "v4.classes.bridges.hyperbridge",
"class": "HyperBridge",
"inputs": {
"a": "nt",
"b": "nt"
},
"level": "patient",
"epochs": 10,
"args": {
"hidden_dim": 256,
"mode": "embedding_mlp"
}
},
{
"name": "hb_head",
"type": "head",
"input": "hb",
"train_with": "hb"
}
],
"training": {
"lr": 0.0001,
"batch_size": 16,
"bcd_prob": 0.5,
"tune_binary_threshold": true
}
},
"mean_val_auc": 0.8926470588235293,
"std_val_auc": 0.06105155516072669,
"mean_test_auc": 0.9022058823529413,
"std_test_auc": 0.035001853633564395,
"elapsed_s": 1525.9,
"fold_results": [
{
"fold": 0,
"nt_val_auc": 0.858647936786655,
"nt_val_acc": 0.8928571428571429,
"nt_val_n": 84,
"nt_val_kappa": 0.6272189349112426,
"nt_val_mcc": 0.6411186083279721,
"nt_val_f1": 0.8124534854874721,
"nt_val_threshold": 0.012987074442207813,
"nt_test_auc": 0.9157155399473222,
"nt_test_acc": 0.9047619047619048,
"nt_test_n": 84,
"hb_val_auc": 0.9080882352941178,
"hb_val_acc": 0.8333333333333334,
"hb_val_n": 42,
"hb_val_kappa": 0.2898550724637682,
"hb_val_mcc": 0.33633639699815626,
"hb_val_f1": 0.6338729763387297,
"hb_val_threshold": 0.011891158297657967,
"hb_test_auc": 0.9522058823529411,
"hb_test_acc": 0.9523809523809523,
"hb_test_n": 42
},
{
"fold": 1,
"nt_val_auc": 0.8282828282828283,
"nt_val_acc": 0.8928571428571429,
"nt_val_n": 84,
"nt_val_kappa": 0.6111111111111112,
"nt_val_mcc": 0.6633249580710799,
"nt_val_f1": 0.801418439716312,
"nt_val_threshold": 0.008082838729023933,
"nt_test_auc": 0.8726953467954346,
"nt_test_acc": 0.8690476190476191,
"nt_test_n": 84,
"hb_val_auc": 0.7904411764705882,
"hb_val_acc": 0.9047619047619048,
"hb_val_n": 42,
"hb_val_kappa": 0.6181818181818182,
"hb_val_mcc": 0.6688560540599386,
"hb_val_f1": 0.8055555555555556,
"hb_val_threshold": 0.013159404508769512,
"hb_test_auc": 0.8970588235294117,
"hb_test_acc": 0.8571428571428571,
"hb_test_n": 42
},
{
"fold": 2,
"nt_val_auc": 0.8906882591093117,
"nt_val_acc": 0.8452380952380952,
"nt_val_n": 84,
"nt_val_kappa": 0.5125,
"nt_val_mcc": 0.5217535056401378,
"nt_val_f1": 0.7548821548821549,
"nt_val_threshold": 0.052708517760038376,
"nt_test_auc": 0.856060606060606,
"nt_test_acc": 0.8333333333333334,
"nt_test_n": 84,
"hb_val_auc": 0.9117647058823529,
"hb_val_acc": 0.8333333333333334,
"hb_val_n": 42,
"hb_val_kappa": 0.36909871244635195,
"hb_val_mcc": 0.3833788364965519,
"hb_val_f1": 0.6814734561213435,
"hb_val_threshold": 0.0401872955262661,
"hb_test_auc": 0.8566176470588236,
"hb_test_acc": 0.8571428571428571,
"hb_test_n": 42
},
{
"fold": 3,
"nt_val_auc": 0.921875,
"nt_val_acc": 0.8928571428571429,
"nt_val_n": 84,
"nt_val_kappa": 0.6758147512864494,
"nt_val_mcc": 0.6797955088067001,
"nt_val_f1": 0.837593984962406,
"nt_val_threshold": 0.708580732345581,
"nt_test_auc": 0.8631578947368421,
"nt_test_acc": 0.8452380952380952,
"nt_test_n": 84,
"hb_val_auc": 0.9779411764705882,
"hb_val_acc": 0.9285714285714286,
"hb_val_n": 42,
"hb_val_kappa": 0.7567567567567568,
"hb_val_mcc": 0.7592566023652966,
"hb_val_f1": 0.8782608695652174,
"hb_val_threshold": 0.04653067886829376,
"hb_test_auc": 0.875,
"hb_test_acc": 0.8809523809523809,
"hb_test_n": 42
},
{
"fold": 4,
"nt_val_auc": 0.8279192273924496,
"nt_val_acc": 0.8571428571428571,
"nt_val_n": 84,
"nt_val_kappa": 0.46325878594249204,
"nt_val_mcc": 0.49610717544581684,
"nt_val_f1": 0.7269772481040087,
"nt_val_threshold": 0.06419441103935242,
"nt_test_auc": 0.8961397058823529,
"nt_test_acc": 0.8928571428571429,
"nt_test_n": 84,
"hb_val_auc": 0.875,
"hb_val_acc": 0.9047619047619048,
"hb_val_n": 42,
"hb_val_kappa": 0.6181818181818182,
"hb_val_mcc": 0.6688560540599386,
"hb_val_f1": 0.8055555555555556,
"hb_val_threshold": 0.23509082198143005,
"hb_test_auc": 0.9301470588235294,
"hb_test_acc": 0.8809523809523809,
"hb_test_n": 42
}
]
}