Merge dev into the CaMa consolidation branch

This commit is contained in:
Roberto Treviño Cervantes
2026-11-22 23:27:34 -06:00
50 changed files with 2781 additions and 123 deletions
+141
View File
@@ -0,0 +1,141 @@
table,outcome,group,curve,knots,gamma,eta,cr0,cr1,cr2,cr3,cr4,cr5,max_abs
1,CIN2+,HPV negativo,AGC,"[0.0, 3.749999999999426, 10.992706060410129]","[-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106]",0.0,0.0241115195644835,0.0256092196204436,0.0268181400278813,0.028171784403177,0.0297901538513425,0.031523974593383,4.440892098500626e-16
1,CIN2+,HPV negativo,ASC-H,"[0.0, 3.749999999999426, 10.992706060410129]","[-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106]",0.675059058469885,0.0953469396720264,0.0980718969717476,0.100268497329922,0.102724939896397,0.10565744916419,0.108793929166055,4.440892098500626e-16
1,CIN2+,HPV negativo,ASC-US,"[0.0, 3.749999999999426, 10.992706060410129]","[-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106]",0.3716720902899113,0.0006886909862562,0.00291195228696667,0.00470541300218982,0.00671238510720408,0.00911019894943088,0.0116770710796392,4.440892098500626e-16
1,CIN2+,HPV negativo,HSIL+,"[0.0, 3.749999999999426, 10.992706060410129]","[-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106]",2.0164005981856348,0.468287640749052,0.474386433098624,0.47926496337816,0.484680892189583,0.491091841584196,0.497883312012614,4.440892098500626e-16
1,CIN2+,HPV negativo,LSIL,"[0.0, 3.749999999999426, 10.992706060410129]","[-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106]",1.0694381631654704,0.0321089460773336,0.036430742300162,0.0399099701641632,0.0437959045534305,0.0484282146868277,0.05337460404111,4.440892098500626e-16
1,CIN2+,HPV negativo,NILM,"[0.0, 3.749999999999426, 10.992706060410129]","[-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106]",-0.6656887215701865,3.90353647266218e-05,0.000828013277650686,0.00146529413171444,0.00217932287701656,0.00303362524453662,0.00394964078320864,4.440892098500626e-16
1,CIN2+,HPV positivo,AGC,"[0.0, 3.7291666666669765, 7.200620785886926]","[-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466]",0.0,0.400884761372207,0.423177327520334,0.453148774204697,0.47722331054264,0.491809730088738,0.500142601911983,7.771561172376096e-16
1,CIN2+,HPV positivo,ASC-H,"[0.0, 3.7291666666669765, 7.200620785886926]","[-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466]",0.2126697727739812,0.501106699178966,0.523966961254572,0.554371985820979,0.578511314319372,0.593010085492955,0.601248908320567,7.771561172376096e-16
1,CIN2+,HPV positivo,ASC-US,"[0.0, 3.7291666666669765, 7.200620785886926]","[-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466]",-0.7533953307304859,0.134977733606003,0.150282229405366,0.171360576935273,0.188738761408003,0.19947466518464,0.205681128069832,7.771561172376096e-16
1,CIN2+,HPV positivo,HSIL+,"[0.0, 3.7291666666669765, 7.200620785886926]","[-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466]",0.007560314353099129,0.768895742132862,0.777558954414099,0.789202267331941,0.798551251948637,0.80421408879622,0.807448580381107,7.771561172376096e-16
1,CIN2+,HPV positivo,LSIL,"[0.0, 3.7291666666669765, 7.200620785886926]","[-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466]",-0.7121375835534804,0.150720429636477,0.166373432071245,0.187912288999706,0.205652819554319,0.216604598846303,0.222933043955648,7.771561172376096e-16
1,CIN2+,HPV positivo,NILM,"[0.0, 3.7291666666669765, 7.200620785886926]","[-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466]",-0.9861148498309161,0.0498612570542781,0.0632060742965726,0.0816675057209598,0.0969615559339089,0.106443878949773,0.111937675985206,7.771561172376096e-16
1,CIN3+,HPV negativo,AGC,"[0.0, 3.7500000000006812, 7.523483812808309]","[-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815]",0.0,0.0106844641637163,0.0115079789994108,0.0121411816481693,0.0128347160639286,0.0136669643759362,0.0145666781897423,3.3306690738754696e-16
1,CIN3+,HPV negativo,ASC-H,"[0.0, 3.7500000000006812, 7.523483812808309]","[-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815]",-0.04872187576775001,0.0342206380443041,0.034986346556643,0.0355751224053339,0.0362200176140623,0.0369939268279508,0.0378306072669854,3.3306690738754696e-16
1,CIN3+,HPV negativo,ASC-US,"[0.0, 3.7500000000006812, 7.523483812808309]","[-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815]",-0.09879946244479822,0.000397811063724171,0.00115163989720337,0.0017313009790938,0.00236623247962954,0.00312821209932418,0.00395202899225357,3.3306690738754696e-16
1,CIN3+,HPV negativo,HSIL+,"[0.0, 3.7500000000006812, 7.523483812808309]","[-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815]",2.004887966546689,0.252144671903415,0.256754712682076,0.260282641941786,0.264130077325419,0.268724170611435,0.273662742092822,3.3306690738754696e-16
1,CIN3+,HPV negativo,LSIL,"[0.0, 3.7500000000006812, 7.523483812808309]","[-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815]",0.8576201610700221,0.0105183209491033,0.0124590219555563,0.013949740055348,0.0155810064976098,0.017536490040242,0.0196479749836111,3.3306690738754696e-16
1,CIN3+,HPV negativo,NILM,"[0.0, 3.7500000000006812, 7.523483812808309]","[-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815]",-1.174571179173883,2.28864043889962e-05,0.000280128375297359,0.000478023113087691,0.000694873939389557,0.000955236140567136,0.00123687521303424,3.3306690738754696e-16
1,CIN3+,HPV positivo,AGC,"[0.0, 3.7291666666666847, 7.292848376237279]","[-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737]",0.0,0.262739413900099,0.276609416274342,0.302317768969549,0.324522607011181,0.338063429715532,0.345343732440977,3.885780586188048e-16
1,CIN3+,HPV positivo,ASC-H,"[0.0, 3.7291666666666847, 7.292848376237279]","[-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737]",-0.09530733394718151,0.25730149160114,0.270014560302542,0.293637521742104,0.314104857280649,0.326616057076886,0.333352370721709,3.885780586188048e-16
1,CIN3+,HPV positivo,ASC-US,"[0.0, 3.7291666666666847, 7.292848376237279]","[-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737]",-1.3767188384949076,0.0444540193603678,0.0490236673279738,0.0576697985578552,0.0653314891820387,0.0700965762622234,0.0726887422509778,3.885780586188048e-16
1,CIN3+,HPV positivo,HSIL+,"[0.0, 3.7291666666666847, 7.292848376237279]","[-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737]",-0.30370002843403754,0.488648915271303,0.495766893454262,0.509055662871487,0.520636978488655,0.527748325122181,0.531587512570922,3.885780586188048e-16
1,CIN3+,HPV positivo,LSIL,"[0.0, 3.7291666666666847, 7.292848376237279]","[-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737]",-1.4329033456135163,0.042676750204802,0.0470053353775885,0.0551984713012144,0.0624621762259645,0.0669813807353154,0.0694403197238233,3.885780586188048e-16
1,CIN3+,HPV positivo,NILM,"[0.0, 3.7291666666666847, 7.292848376237279]","[-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737]",-1.4575108528337812,0.0213187485278357,0.0256365794003271,0.0338106666152414,0.0410589243006993,0.0455692063201592,0.0480235134204469,3.885780586188048e-16
17,CIN2+,label_0+label_2: High Grade | HPV-negative,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 3.95989990234375, 4.47021484375]","[-3.9228738479090945, -2.641724806005263, -3.734740862816677, -4.055863260141345, -4.947911436939447]",0.0,0.123579923952225,0.15102756718187801,0.184365754779829,0.210945417069017,0.227846791207951,0.237559121707946,4.163336342344337e-16
17,CIN2+,label_0+label_2: High Grade | HPV-negative,<CIN2 | ASC-US/LSIL,"[0.0, 3.95989990234375, 4.47021484375]","[-3.9228738479090945, -2.641724806005263, -3.734740862816677, -4.055863260141345, -4.947911436939447]",-1.0672586464162441,0.008007515968007129,0.0188047699694367,0.0322318229603189,0.0431971868013434,0.0502963963549639,0.054422158764861395,4.163336342344337e-16
17,CIN2+,label_0+label_2: High Grade | HPV-negative,<CIN2 | NILM,"[0.0, 3.95989990234375, 4.47021484375]","[-3.9228738479090945, -2.641724806005263, -3.734740862816677, -4.055863260141345, -4.947911436939447]",-2.5402918082419363,0.00021709070750837198,0.00272210458747353,0.00586705802785506,0.00846046698055248,0.0101517369447562,0.0111391137977098,4.163336342344337e-16
17,CIN2+,label_0+label_2: High Grade | HPV-positive,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 2.75, 5.5]","[-3.5065053026338764, -1.8731662048345261, -2.3420581756483396, -3.811317909251368, -4.133916986812303]",0.0,0.539026420832674,0.570211122864893,0.606491135373487,0.634169795753661,0.6511985060144551,0.660783913749291,4.440892098500626e-16
17,CIN2+,label_0+label_2: High Grade | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 2.75, 5.5]","[-3.5065053026338764, -1.8731662048345261, -2.3420581756483396, -3.811317909251368, -4.133916986812303]",-0.319733986184771,0.206897038243222,0.246239084107875,0.293008432352947,0.329486737548833,0.352304022461775,0.365281610981382,4.440892098500626e-16
17,CIN2+,label_0+label_2: High Grade | HPV-positive,<CIN2 | NILM,"[0.0, 2.75, 5.5]","[-3.5065053026338764, -1.8731662048345261, -2.3420581756483396, -3.811317909251368, -4.133916986812303]",-0.6515872090196151,0.09983770568447399,0.132109526744864,0.171100384178412,0.20201930698049397,0.22160052012735001,0.232824345859495,4.440892098500626e-16
17,CIN2+,label_0+label_2: Low Grade | HPV-negative,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 2.75, 5.5]","[-9.60325253538708, -3.7390337694370426, -4.32693762836679, -8.059250158880516, -5.539079202132769]",0.0,0.0818102195529921,0.08816299645362341,0.0994708114947793,0.10864916988177599,0.113888872396136,0.11695548954333301,1.5959455978986625e-16
17,CIN2+,label_0+label_2: Low Grade | HPV-negative,<CIN2 | ASC-US/LSIL,"[0.0, 2.75, 5.5]","[-9.60325253538708, -3.7390337694370426, -4.32693762836679, -8.059250158880516, -5.539079202132769]",-0.032048176979885025,0.0046423195748839605,0.011312529019801001,0.0231890012469638,0.0328323851663901,0.038338961914485596,0.0415622474077153,1.5959455978986625e-16
17,CIN2+,label_0+label_2: Low Grade | HPV-negative,<CIN2 | NILM,"[0.0, 2.75, 5.5]","[-9.60325253538708, -3.7390337694370426, -4.32693762836679, -8.059250158880516, -5.539079202132769]",-0.9340386881343488,6.352805491541261e-05,0.0027879235521406,0.00766594465494657,0.0116527593369533,0.0139399179550898,0.0152823233565092,1.5959455978986625e-16
17,CIN2+,label_0+label_2: Low Grade | HPV-positive,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 2.8531250000000004, 5.3625]","[-7.48294359780084, -1.8089325565913317, -2.494687509379357, -4.681199745539646, -3.882722349957299]",0.0,0.49306433151293594,0.516539536787493,0.556033375006267,0.586032637229327,0.6023693176552191,0.611672827894284,8.881784197001252e-16
17,CIN2+,label_0+label_2: Low Grade | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 2.8531250000000004, 5.3625]","[-7.48294359780084, -1.8089325565913317, -2.494687509379357, -4.681199745539646, -3.882722349957299]",-0.9030074448223038,0.11667547120604099,0.133490367287367,0.162911881278714,0.18631750771560898,0.199489640993048,0.20713523821422497,8.881784197001252e-16
17,CIN2+,label_0+label_2: Low Grade | HPV-positive,<CIN2 | NILM,"[0.0, 2.8531250000000004, 5.3625]","[-7.48294359780084, -1.8089325565913317, -2.494687509379357, -4.681199745539646, -3.882722349957299]",-1.1294181009525135,0.06097283674749279,0.07525408930616,0.100378568900568,0.120493677221056,0.131865432528085,0.138483393848094,8.881784197001252e-16
17,CIN2+,label_0: High Grade,<CIN2 | HPV-negative | ASC-H/AGC/HSIL+,"[0.0, 3.2499999999999982, 8.524999999999997]","[-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708]",0.0,0.123579923952225,0.15102756718187801,0.184365754779829,0.210945417069017,0.227846791207951,0.237559121707946,4.440892098500626e-16
17,CIN2+,label_0: High Grade,<CIN2 | HPV-negative | ASC-US/LSIL,"[0.0, 3.2499999999999982, 8.524999999999997]","[-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708]",-1.0672586464162428,0.008007515968007129,0.0188047699694367,0.0322318229603189,0.0431971868013434,0.0502963963549639,0.054422158764861395,4.440892098500626e-16
17,CIN2+,label_0: High Grade,<CIN2 | HPV-negative | NILM,"[0.0, 3.2499999999999982, 8.524999999999997]","[-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708]",-2.5402918082419377,0.00021709070750837198,0.00272210458747353,0.00586705802785506,0.00846046698055248,0.0101517369447562,0.0111391137977098,4.440892098500626e-16
17,CIN2+,label_0: High Grade,<CIN2 | HPV-positive | ASC-H/AGC/HSIL+,"[0.0, 3.2499999999999982, 8.524999999999997]","[-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708]",0.7891037999664713,0.539026420832674,0.570211122864893,0.606491135373487,0.634169795753661,0.6511985060144551,0.660783913749291,4.440892098500626e-16
17,CIN2+,label_0: High Grade,<CIN2 | HPV-positive | ASC-US/LSIL,"[0.0, 3.2499999999999982, 8.524999999999997]","[-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708]",0.46936981378170023,0.206897038243222,0.246239084107875,0.293008432352947,0.329486737548833,0.352304022461775,0.365281610981382,4.440892098500626e-16
17,CIN2+,label_0: High Grade,<CIN2 | HPV-positive | NILM,"[0.0, 3.2499999999999982, 8.524999999999997]","[-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708]",0.1375165909468566,0.09983770568447399,0.132109526744864,0.171100384178412,0.20201930698049397,0.22160052012735001,0.232824345859495,4.440892098500626e-16
17,CIN2+,label_0: Low Grade,<CIN2 | HPV-negative | ASC-H/AGC/HSIL+,"[0.0, 3.40234375, 6.5203125]","[-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177]",0.0,0.0818102195529921,0.08816299645362341,0.0994708114947793,0.10864916988177599,0.113888872396136,0.11695548954333301,6.661338147750939e-16
17,CIN2+,label_0: Low Grade,<CIN2 | HPV-negative | ASC-US/LSIL,"[0.0, 3.40234375, 6.5203125]","[-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177]",-0.032048176979882936,0.0046423195748839605,0.011312529019801001,0.0231890012469638,0.0328323851663901,0.038338961914485596,0.0415622474077153,6.661338147750939e-16
17,CIN2+,label_0: Low Grade,<CIN2 | HPV-negative | NILM,"[0.0, 3.40234375, 6.5203125]","[-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177]",-0.9340386881343479,6.352805491541261e-05,0.0027879235521406,0.00766594465494657,0.0116527593369533,0.0139399179550898,0.0152823233565092,6.661338147750939e-16
17,CIN2+,label_0: Low Grade,<CIN2 | HPV-positive | ASC-H/AGC/HSIL+,"[0.0, 3.40234375, 6.5203125]","[-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177]",1.9212169342400942,0.49306433151293594,0.516539536787493,0.556033375006267,0.586032637229327,0.6023693176552191,0.611672827894284,6.661338147750939e-16
17,CIN2+,label_0: Low Grade,<CIN2 | HPV-positive | ASC-US/LSIL,"[0.0, 3.40234375, 6.5203125]","[-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177]",1.0182094894177909,0.11667547120604099,0.133490367287367,0.162911881278714,0.18631750771560898,0.199489640993048,0.20713523821422497,6.661338147750939e-16
17,CIN2+,label_0: Low Grade,<CIN2 | HPV-positive | NILM,"[0.0, 3.40234375, 6.5203125]","[-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177]",0.7917988332875814,0.06097283674749279,0.07525408930616,0.100378568900568,0.120493677221056,0.131865432528085,0.138483393848094,6.661338147750939e-16
17,CIN3+,label_0+label_2: High Grade | HPV-negative,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 3.35150480270386, 5.140167140960691]","[-11.008186733553266, -2.748795416105142, -4.010248009038462, -4.60664472360736, -6.087336519091521]",0.0,0.056152193511642905,0.0714736818636741,0.0987872766172283,0.120837895850705,0.133591678274714,0.14053180371033702,1.3877787807814457e-16
17,CIN3+,label_0+label_2: High Grade | HPV-negative,<CIN2 | ASC-US/LSIL,"[0.0, 3.35150480270386, 5.140167140960691]","[-11.008186733553266, -2.748795416105142, -4.010248009038462, -4.60664472360736, -6.087336519091521]",-2.189971905541478,0.0028073559928682,0.00463224593407769,0.00795285226750279,0.0106994765123714,0.012316140575016302,0.0132047680498179,1.3877787807814457e-16
17,CIN3+,label_0+label_2: High Grade | HPV-negative,<CIN2 | NILM,"[0.0, 3.35150480270386, 5.140167140960691]","[-11.008186733553266, -2.748795416105142, -4.010248009038462, -4.60664472360736, -6.087336519091521]",-3.0083113846638474,0.000217474670789548,0.00102505375178246,0.00249666617420671,0.00371598505957691,0.00443456123574488,0.00482981907149305,1.3877787807814457e-16
17,CIN3+,label_0+label_2: High Grade | HPV-positive,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 3.3515625000000027, 5.388281249999999]","[-10.54691011249509, -2.240786746752028, -3.632622617326058, -4.17107995201359, -5.755718773586673]",0.0,0.283925046033346,0.302266314811659,0.33452512019192904,0.360154491149052,0.374807893081757,0.382728941543987,4.996003610813204e-16
17,CIN3+,label_0+label_2: High Grade | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 3.3515625000000027, 5.388281249999999]","[-10.54691011249509, -2.240786746752028, -3.632622617326058, -4.17107995201359, -5.755718773586673]",-0.20773512406798625,0.0660029115279839,0.0854856922082638,0.11998776652616999,0.14762324557453899,0.163516655451206,0.172137039735473,4.996003610813204e-16
17,CIN3+,label_0+label_2: High Grade | HPV-positive,<CIN2 | NILM,"[0.0, 3.3515625000000027, 5.388281249999999]","[-10.54691011249509, -2.240786746752028, -3.632622617326058, -4.17107995201359, -5.755718773586673]",-0.7339090471758761,0.0502224880729527,0.061979053698500604,0.08305330055168661,0.100178305176523,0.110129965710093,0.115559974612717,4.996003610813204e-16
17,CIN3+,label_0+label_2: Low Grade | HPV-negative,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 3.3921875000000004, 6.4796875]","[-12.617897003010304, -3.7970179725994324, -6.525658531159966, -6.073030586317113, -6.257924890927562]",0.0,0.0164593639076601,0.020865910131221202,0.0288255780656094,0.0352978662713855,0.0389342494067136,0.040947433590996195,1.1796119636642288e-16
17,CIN3+,label_0+label_2: Low Grade | HPV-negative,<CIN2 | ASC-US/LSIL,"[0.0, 3.3921875000000004, 6.4796875]","[-12.617897003010304, -3.7970179725994324, -6.525658531159966, -6.073030586317113, -6.257924890927562]",-1.0508854390530271,0.00045816445105480803,0.00202616816773695,0.0048701701194103705,0.00719392459035741,0.00850395144411777,0.00923059884268837,1.1796119636642288e-16
17,CIN3+,label_0+label_2: Low Grade | HPV-negative,<CIN2 | NILM,"[0.0, 3.3921875000000004, 6.4796875]","[-12.617897003010304, -3.7970179725994324, -6.525658531159966, -6.073030586317113, -6.257924890927562]",-1.801676728882616,3.1533490176679904e-05,0.0007722429160041671,0.00211729098575043,0.00321779960310556,0.0038388157570307404,0.00418346861821767,1.1796119636642288e-16
17,CIN3+,label_0+label_2: Low Grade | HPV-positive,<CIN2 | ASC-H/AGC/HSIL+,"[0.0, 3.4375000000000027, 4.9499999999999975]","[-10.826280746746997, -2.620033444443425, -3.9378457923904575, -4.578177810857306, -5.766887479985344]",0.0,0.22971674078599702,0.244083348646396,0.269516047197888,0.289711503374328,0.300869906443187,0.306989756904408,2.220446049250313e-16
17,CIN3+,label_0+label_2: Low Grade | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 3.4375000000000027, 4.9499999999999975]","[-10.826280746746997, -2.620033444443425, -3.9378457923904575, -4.578177810857306, -5.766887479985344]",-1.2387735560750097,0.0310566408302113,0.0363278167844026,0.0458363669929681,0.053555780922701406,0.0578879736180621,0.0602848606723243,2.220446049250313e-16
17,CIN3+,label_0+label_2: Low Grade | HPV-positive,<CIN2 | NILM,"[0.0, 3.4375000000000027, 4.9499999999999975]","[-10.826280746746997, -2.620033444443425, -3.9378457923904575, -4.578177810857306, -5.766887479985344]",-1.1595249391199973,0.0205211557608812,0.026287808771337698,0.036683552066823805,0.0451169464582727,0.0498473486599558,0.0524637842176785,2.220446049250313e-16
17,CIN3+,label_0: High Grade,<CIN2 | HPV-negative | ASC-H/AGC/HSIL+,"[0.0, 3.3000000000000025, 5.431249999999999]","[-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483]",0.0,0.056152193511642905,0.0714736818636741,0.0987872766172283,0.120837895850705,0.133591678274714,0.14053180371033702,4.996003610813204e-16
17,CIN3+,label_0: High Grade,<CIN2 | HPV-negative | ASC-US/LSIL,"[0.0, 3.3000000000000025, 5.431249999999999]","[-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483]",-2.189971905541481,0.0028073559928682,0.00463224593407769,0.00795285226750279,0.0106994765123714,0.012316140575016302,0.0132047680498179,4.996003610813204e-16
17,CIN3+,label_0: High Grade,<CIN2 | HPV-negative | NILM,"[0.0, 3.3000000000000025, 5.431249999999999]","[-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483]",-3.008311384663847,0.000217474670789548,0.00102505375178246,0.00249666617420671,0.00371598505957691,0.00443456123574488,0.00482981907149305,4.996003610813204e-16
17,CIN3+,label_0: High Grade,<CIN2 | HPV-positive | ASC-H/AGC/HSIL+,"[0.0, 3.3000000000000025, 5.431249999999999]","[-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483]",0.46085110304222565,0.283925046033346,0.302266314811659,0.33452512019192904,0.360154491149052,0.374807893081757,0.382728941543987,4.996003610813204e-16
17,CIN3+,label_0: High Grade,<CIN2 | HPV-positive | ASC-US/LSIL,"[0.0, 3.3000000000000025, 5.431249999999999]","[-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483]",0.2531159789742397,0.0660029115279839,0.0854856922082638,0.11998776652616999,0.14762324557453899,0.163516655451206,0.172137039735473,4.996003610813204e-16
17,CIN3+,label_0: High Grade,<CIN2 | HPV-positive | NILM,"[0.0, 3.3000000000000025, 5.431249999999999]","[-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483]",-0.27305794413365025,0.0502224880729527,0.061979053698500604,0.08305330055168661,0.100178305176523,0.110129965710093,0.115559974612717,4.996003610813204e-16
17,CIN3+,label_0: Low Grade,<CIN2 | HPV-negative | ASC-H/AGC/HSIL+,"[0.0, 3.9189535140991256, 4.434260654449458]","[-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621]",0.0,0.0164593639076601,0.020865910131221202,0.0288255780656094,0.0352978662713855,0.0389342494067136,0.040947433590996195,2.220446049250313e-16
17,CIN3+,label_0: Low Grade,<CIN2 | HPV-negative | ASC-US/LSIL,"[0.0, 3.9189535140991256, 4.434260654449458]","[-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621]",-1.0508854390530284,0.00045816445105480803,0.00202616816773695,0.0048701701194103705,0.00719392459035741,0.00850395144411777,0.00923059884268837,2.220446049250313e-16
17,CIN3+,label_0: Low Grade,<CIN2 | HPV-negative | NILM,"[0.0, 3.9189535140991256, 4.434260654449458]","[-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621]",-1.8016767288826154,3.1533490176679904e-05,0.0007722429160041671,0.00211729098575043,0.00321779960310556,0.0038388157570307404,0.00418346861821767,2.220446049250313e-16
17,CIN3+,label_0: Low Grade,<CIN2 | HPV-positive | ASC-H/AGC/HSIL+,"[0.0, 3.9189535140991256, 4.434260654449458]","[-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621]",1.4333705313265157,0.22971674078599702,0.244083348646396,0.269516047197888,0.289711503374328,0.300869906443187,0.306989756904408,2.220446049250313e-16
17,CIN3+,label_0: Low Grade,<CIN2 | HPV-positive | ASC-US/LSIL,"[0.0, 3.9189535140991256, 4.434260654449458]","[-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621]",0.19459697525150654,0.0310566408302113,0.0363278167844026,0.0458363669929681,0.053555780922701406,0.0578879736180621,0.0602848606723243,2.220446049250313e-16
17,CIN3+,label_0: Low Grade,<CIN2 | HPV-positive | NILM,"[0.0, 3.9189535140991256, 4.434260654449458]","[-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621]",0.2738455922065207,0.0205211557608812,0.026287808771337698,0.036683552066823805,0.0451169464582727,0.0498473486599558,0.0524637842176785,2.220446049250313e-16
18,CIN2+,label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 2.8529907226562505, 4.98558349609375]","[-10.34844881940246, -2.24210128461073, -4.564413713372809, -6.455917689788004, -10.613171503266397]",0.0,0.0754015255440931,0.103265794337961,0.145179223258591,0.169473034365134,0.177288570696931,0.17854208342549,5.551115123125783e-16
18,CIN2+,label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive,<CIN2 | High Grade,"[0.0, 2.8529907226562505, 4.98558349609375]","[-10.34844881940246, -2.24210128461073, -4.564413713372809, -6.455917689788004, -10.613171503266397]",0.7616733125518199,0.499132506342513,0.530907195266614,0.576617975356811,0.60197210394162,0.609951509308618,0.61122329054014,5.551115123125783e-16
18,CIN2+,label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive,<CIN2 | NILM,"[0.0, 2.8529907226562505, 4.98558349609375]","[-10.34844881940246, -2.24210128461073, -4.564413713372809, -6.455917689788004, -10.613171503266397]",-0.8363475431129561,2.38238037242056e-15,0.013171196210381599,0.0334278190860156,0.045427494874570096,0.0493301039184659,0.0499579850656342,5.551115123125783e-16
18,CIN2+,label_0+label_2+label_3: High Grade | HPV-negative/ASCUS/LSIL | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 1.993764424324036, 5.465644538402557]","[-8.058643072974567, -1.8886850796043781, -1.2230492132635378, -3.60609859472805, -4.573943855420296]",0.0,2.10984399628414e-18,0.0642167383232001,0.18451512993242702,0.288932661609402,0.35257094621844204,0.37886263581951196,3.3306690738754696e-16
18,CIN2+,label_0+label_2+label_3: High Grade | HPV-negative/ASCUS/LSIL | HPV-positive,<CIN2 | High Grade,"[0.0, 1.993764424324036, 5.465644538402557]","[-8.058643072974567, -1.8886850796043781, -1.2230492132635378, -3.60609859472805, -4.573943855420296]",1.1563566686924174,0.833305441055717,0.865008364666254,0.9128290596846701,0.9436044942776021,0.958137282157014,0.96330532556192,3.3306690738754696e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 2.75, 5.5]","[-3.9596440054374784, -3.378672278185891, -3.9875232602526585, -3.6722810703457265, -4.280386842686037]",0.0,0.0659044703742194,0.089746688578391,0.109230111875092,0.12529894916311102,0.140192313505222,0.155753880872501,5.551115123125783e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive,<CIN2 | High Grade,"[0.0, 2.75, 5.5]","[-3.9596440054374784, -3.378672278185891, -3.9875232602526585, -3.6722810703457265, -4.280386842686037]",0.5773343339569103,0.5912195695356339,0.609619591237797,0.6243790956833439,0.636363776097805,0.647319257929656,0.658608929897879,5.551115123125783e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive,<CIN2 | NILM,"[0.0, 2.75, 5.5]","[-3.9596440054374784, -3.378672278185891, -3.9875232602526585, -3.6722810703457265, -4.280386842686037]",-0.9820914167155511,0.0360575716765237,0.0453470409822074,0.0530518709507203,0.0594860854426566,0.0655159757267125,0.07188660783930981,5.551115123125783e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative,<CIN2 | ASC-US/LSIL,"[0.0, 2.75, 5.5]","[-20.536131988436342, -4.260644311297781, -3.356872403985886, -4.45548462017129, -5.841778904258112]",0.0,0.0131140716015184,0.018207911105975902,0.0312017894163993,0.047561186468938796,0.0620103077731488,0.0712615583346978,3.3306690738754696e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative,<CIN2 | High Grade,"[0.0, 2.75, 5.5]","[-20.536131988436342, -4.260644311297781, -3.356872403985886, -4.45548462017129, -5.841778904258112]",-11.455432116776514,0.300073811964724,0.300073850328629,0.300073949099842,0.300074075354672,0.300074188683584,0.30007426216439703,3.3306690738754696e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative,<CIN2 | NILM,"[0.0, 2.75, 5.5]","[-20.536131988436342, -4.260644311297781, -3.356872403985886, -4.45548462017129, -5.841778904258112]",-1.039851888850465,1.17957341124561e-14,0.00182768948185797,0.006517879154542669,0.012481064395005601,0.0178032520807647,0.021238743258582802,3.3306690738754696e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 2.749972265958786, 5.499840152263641]","[-19.34733193429554, -4.88827911091044, -3.9845120611245077, -5.082976995007613, -6.469267687925621]",0.0,0.07351057572352189,0.07606669896412671,0.08261525750923729,0.0909184496853561,0.098307541381759,0.10306639528883099,3.3306690738754696e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-positive,<CIN2 | High Grade,"[0.0, 2.749972265958786, 5.499840152263641]","[-19.34733193429554, -4.88827911091044, -3.9845120611245077, -5.082976995007613, -6.469267687925621]",4.061397297742704,0.230831397902068,0.3448148392882,0.5664644165634131,0.7442690505691949,0.840774931785191,0.8828905441660799,3.3306690738754696e-16
18,CIN2+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-positive,<CIN2 | NILM,"[0.0, 2.749972265958786, 5.499840152263641]","[-19.34733193429554, -4.88827911091044, -3.9845120611245077, -5.082976995007613, -6.469267687925621]",0.9425976641150026,0.036133527238391,0.0429441067797216,0.060257919509119004,0.08193408722379729,0.10096490141836799,0.11309287374098201,3.3306690738754696e-16
18,CIN3+,label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 2.8187500000000014, 4.88125]","[-21.931975912646944, -19.932014656863323, -21.959260875279913, -24.216762631029734, -25.901625072089512]",0.0,0.018868845497754902,0.0188688463833303,0.0188688474376925,0.0188688480451513,0.0188688482436359,0.0188688482756456,3.3306690738754696e-16
18,CIN3+,label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive,<CIN2 | High Grade,"[0.0, 2.8187500000000014, 4.88125]","[-21.931975912646944, -19.932014656863323, -21.959260875279913, -24.216762631029734, -25.901625072089512]",18.299272734135396,0.49755217974530097,0.5361550132958299,0.578266941318611,0.60077031262867,0.607859732457989,0.608991201389804,3.3306690738754696e-16
18,CIN3+,label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive,<CIN2 | NILM,"[0.0, 2.8187500000000014, 4.88125]","[-21.931975912646944, -19.932014656863323, -21.959260875279913, -24.216762631029734, -25.901625072089512]",16.680005520674186,7.72700650525083e-14,0.0157072262649549,0.03408677208965,0.0445196994119019,0.0479041281479215,0.0484488140137436,3.3306690738754696e-16
18,CIN3+,label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive,<CIN2 | ASC-US/LSIL,"[0.0, 3.2656250000000018, 5.568750000000001]","[-11.005120843490367, -4.072537754707295, -5.0977913217951665, -4.988725499836527, -6.606418997592393]",0.0,0.0112275700334512,0.015367350846191199,0.023149001780099397,0.030254251011826997,0.0356877959932409,0.0400104534558627,3.608224830031759e-16
18,CIN3+,label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive,<CIN2 | High Grade,"[0.0, 3.2656250000000018, 5.568750000000001]","[-11.005120843490367, -4.072537754707295, -5.0977913217951665, -4.988725499836527, -6.606418997592393]",1.1781712219333076,0.157836568529019,0.169236578546972,0.19037560996425398,0.20934934334176,0.223649651775841,0.23489762154274,3.608224830031759e-16
18,CIN3+,label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive,<CIN2 | NILM,"[0.0, 3.2656250000000018, 5.568750000000001]","[-11.005120843490367, -4.072537754707295, -5.0977913217951665, -4.988725499836527, -6.606418997592393]",-0.5125493120224014,0.010348964132360201,0.0128328458157558,0.0175132256919939,0.0217998505127751,0.0250864342949192,0.0277063839176718,3.608224830031759e-16
18,CIN3+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative,<CIN2 | ASC-US/LSIL,"[0.0, 3.473531723022455, 4.096420288085933]","[-9.852766225403219, -5.348005437798218, -9.227888582465996, -8.275788592809148, -9.138133904340833]",0.0,0.006557383449894349,0.00795848645101952,0.010099205818607,0.0113355021822377,0.0117227067039258,0.0117796357536864,5.551115123125783e-17
18,CIN3+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative,<CIN2 | High Grade,"[0.0, 3.473531723022455, 4.096420288085933]","[-9.852766225403219, -5.348005437798218, -9.227888582465996, -8.275788592809148, -9.138133904340833]",-11.266547261922307,0.0999947153911425,0.09999473164211899,0.099994756516062,0.0999947709056376,0.0999947754161124,0.0999947760794175,5.551115123125783e-17
18,CIN3+,label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative,<CIN2 | NILM,"[0.0, 3.473531723022455, 4.096420288085933]","[-9.852766225403219, -5.348005437798218, -9.227888582465996, -8.275788592809148, -9.138133904340833]",-0.5297140871380742,3.5738078826717895e-35,0.000830618074109002,0.00210063628986212,0.00283460464295726,0.00306455905801228,0.00309837141083125,5.551115123125783e-17
18,CIN3+,label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL,<CIN2 | HPV-negative | ASC-US/LSIL,"[0.0, 2.7500272259116176, 5.281872798502446]","[-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774]",0.0,0.006557383449894349,0.00795848645101952,0.010099205818607,0.0113355021822377,0.0117227067039258,0.0117796357536864,2.4216739724636227e-15
18,CIN3+,label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL,<CIN2 | HPV-negative | High Grade,"[0.0, 2.7500272259116176, 5.281872798502446]","[-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774]",-11.266547261886572,0.0999947153911425,0.09999473164211899,0.099994756516062,0.0999947709056376,0.0999947754161124,0.0999947760794175,2.4216739724636227e-15
18,CIN3+,label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL,<CIN2 | HPV-negative | NILM,"[0.0, 2.7500272259116176, 5.281872798502446]","[-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774]",-0.5297140871380728,3.5738078826717895e-35,0.000830618074109002,0.00210063628986212,0.00283460464295726,0.00306455905801228,0.00309837141083125,2.4216739724636227e-15
18,CIN3+,label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL,<CIN2 | HPV-positive | ASC-US/LSIL,"[0.0, 2.7500272259116176, 5.281872798502446]","[-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774]",-27.299467870607586,0.0147068843215046,0.0147068843215059,0.0147068843215079,0.014706884321509,0.0147068843215093,0.014706884321509399,2.4216739724636227e-15
18,CIN3+,label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL,<CIN2 | HPV-positive | High Grade,"[0.0, 2.7500272259116176, 5.281872798502446]","[-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774]",4.4558478579098715,0.0769197677445438,0.182575885831324,0.321353903291499,0.39060597796332,0.410823095045538,0.413739088439336,2.4216739724636227e-15
18,CIN3+,label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL,<CIN2 | HPV-positive | NILM,"[0.0, 2.7500272259116176, 5.281872798502446]","[-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774]",1.3214479115965938,5.106044319392471e-40,0.00527694836759951,0.0133000310093961,0.017911804765725802,0.0193529432788598,0.019564696974458298,2.4216739724636227e-15
24,CIN2+,label_1: HPV-negative,Treatment for CIN 3 | ASC-US/LSIL,"[0.0, 3.0250000000000004, 5.225]","[-5.970564123896623, -2.9583893638499363, -4.516974672861336, -5.780793455732832, -6.209824875259012]",0.0,0.0262214431467089,0.0416928080114781,0.0646927106456137,0.0807470937165037,0.08826314484108369,0.0917702560686117,4.163336342344337e-16
24,CIN2+,label_1: HPV-negative,Treatment for CIN 3 | High Grade,"[0.0, 3.0250000000000004, 5.225]","[-5.970564123896623, -2.9583893638499363, -4.516974672861336, -5.780793455732832, -6.209824875259012]",-10.729002075719931,0.21056564309331802,0.21056591998573299,0.21056633999139301,0.210566639329971,0.21056678127012798,0.21056684790255598,4.163336342344337e-16
24,CIN2+,label_1: HPV-negative,Treatment for CIN 3 | NILM,"[0.0, 3.0250000000000004, 5.225]","[-5.970564123896623, -2.9583893638499363, -4.516974672861336, -5.780793455732832, -6.209824875259012]",-0.9535043052028737,0.00114916052911648,0.0072952786692584305,0.0165459402914708,0.023086242714399397,0.026172299707561398,0.0276176550475499,4.163336342344337e-16
24,CIN2+,label_1: HPV-positive,Treatment for CIN 3 | ASC-US/LSIL,"[0.0, 2.8875, 5.225]","[-4.909963766900336, -1.87064845459847, -3.1538174160037586, -5.191561600237883, -4.820452622627722]",0.0,0.21346052558124298,0.25135818692788603,0.305386982153937,0.341496774219641,0.35795709489185595,0.365541687427744,4.440892098500626e-16
24,CIN2+,label_1: HPV-positive,Treatment for CIN 3 | High Grade,"[0.0, 2.8875, 5.225]","[-4.909963766900336, -1.87064845459847, -3.1538174160037586, -5.191561600237883, -4.820452622627722]",0.4241078676772622,0.718841415723524,0.7392788126726241,0.7674794483957981,0.785696434253688,0.793828658616323,0.797539091168836,4.440892098500626e-16
24,CIN2+,label_1: HPV-positive,Treatment for CIN 3 | NILM,"[0.0, 2.8875, 5.225]","[-4.909963766900336, -1.87064845459847, -3.1538174160037586, -5.191561600237883, -4.820452622627722]",-0.2934210941211471,0.08629421216615149,0.11932921444308199,0.167172915569126,0.199676460972488,0.214642521254526,0.22157134454827,4.440892098500626e-16
24,CIN2+,(todas juntas): ,Treatment for CIN 3 | HPV-negative | ASC-US/LSIL,"[0.0, 3.0392578124999985, 6.147070312500004]","[-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997]",0.0,0.0262214431467089,0.0416928080114781,0.0646927106456137,0.0807470937165037,0.08826314484108369,0.0917702560686117,4.440892098500626e-16
24,CIN2+,(todas juntas): ,Treatment for CIN 3 | HPV-negative | High Grade,"[0.0, 3.0392578124999985, 6.147070312500004]","[-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997]",-10.729002075702507,0.21056564309331802,0.21056591998573299,0.21056633999139301,0.210566639329971,0.21056678127012798,0.21056684790255598,4.440892098500626e-16
24,CIN2+,(todas juntas): ,Treatment for CIN 3 | HPV-negative | NILM,"[0.0, 3.0392578124999985, 6.147070312500004]","[-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997]",-0.9535043052028733,0.00114916052911648,0.0072952786692584305,0.0165459402914708,0.023086242714399397,0.026172299707561398,0.0276176550475499,4.440892098500626e-16
24,CIN2+,(todas juntas): ,Treatment for CIN 3 | HPV-positive | ASC-US/LSIL,"[0.0, 3.0392578124999985, 6.147070312500004]","[-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997]",1.126031972593485,0.21346052558124298,0.25135818692788603,0.305386982153937,0.341496774219641,0.35795709489185595,0.365541687427744,4.440892098500626e-16
24,CIN2+,(todas juntas): ,Treatment for CIN 3 | HPV-positive | High Grade,"[0.0, 3.0392578124999985, 6.147070312500004]","[-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997]",1.550139840270747,0.718841415723524,0.7392788126726241,0.7674794483957981,0.785696434253688,0.793828658616323,0.797539091168836,4.440892098500626e-16
24,CIN2+,(todas juntas): ,Treatment for CIN 3 | HPV-positive | NILM,"[0.0, 3.0392578124999985, 6.147070312500004]","[-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997]",0.8326108784723378,0.08629421216615149,0.11932921444308199,0.167172915569126,0.199676460972488,0.214642521254526,0.22157134454827,4.440892098500626e-16
24,CIN3+,label_1: HPV-negative,Treatment for CIN 3 | ASC-US/LSIL,"[0.0, 3.2656250000000018, 4.674999999999999]","[-10.75052455883268, -3.7407644366146644, -5.366941921959517, -6.1266345031929, -7.140714307357668]",0.0,0.00749275883282888,0.0140702718574874,0.0251859308624384,0.0331275183226566,0.036734651218946104,0.0381750857365055,2.220446049250313e-16
24,CIN3+,label_1: HPV-negative,Treatment for CIN 3 | High Grade,"[0.0, 3.2656250000000018, 4.674999999999999]","[-10.75052455883268, -3.7407644366146644, -5.366941921959517, -6.1266345031929, -7.140714307357668]",-10.453417548881681,0.175428184775675,0.17542834295072499,0.175428612672362,0.175428807265387,0.17542889617954,0.17542893177864202,2.220446049250313e-16
24,CIN3+,label_1: HPV-negative,Treatment for CIN 3 | NILM,"[0.0, 3.2656250000000018, 4.674999999999999]","[-10.75052455883268, -3.7407644366146644, -5.366941921959517, -6.1266345031929, -7.140714307357668]",-0.6387834786259222,0.000288048962219205,0.0037912398055393298,0.009736625843226439,0.0140039316381632,0.0159476393037477,0.0167247788723049,2.220446049250313e-16
24,CIN3+,label_1: HPV-positive,Treatment for CIN 3 | ASC-US/LSIL,"[0.0, 3.2656250000000018, 4.674999999999999]","[-9.365330068085091, -2.3555699458788215, -3.9817474312236376, -4.741440012456921, -5.7555198166218045]",0.0,0.102172567414265,0.125711673454009,0.16443615710668202,0.191304726578008,0.20329233727663698,0.20804192662846,5.551115123125783e-16
24,CIN3+,label_1: HPV-positive,Treatment for CIN 3 | High Grade,"[0.0, 3.2656250000000018, 4.674999999999999]","[-9.365330068085091, -2.3555699458788215, -3.9817474312236376, -4.741440012456921, -5.7555198166218045]",0.65783616404365,0.527002022130951,0.550651254477406,0.58828309749054,0.613460217784654,0.624445965439573,0.628756365442339,5.551115123125783e-16
24,CIN3+,label_1: HPV-positive,Treatment for CIN 3 | NILM,"[0.0, 3.2656250000000018, 4.674999999999999]","[-9.365330068085091, -2.3555699458788215, -3.9817474312236376, -4.741440012456921, -5.7555198166218045]",-0.6016494080274817,0.058115292449263896,0.0717266377266579,0.09448470144641959,0.11055643859221301,0.117804742530884,0.120690204232158,5.551115123125783e-16
24,CIN3+,(todas juntas): ,Treatment for CIN 3 | HPV-negative | ASC-US/LSIL,"[0.0, 3.2449462890625016, 4.685742187499999]","[-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049]",0.0,0.00749275883282888,0.0140702718574874,0.0251859308624384,0.0331275183226566,0.036734651218946104,0.0381750857365055,5.551115123125783e-16
24,CIN3+,(todas juntas): ,Treatment for CIN 3 | HPV-negative | High Grade,"[0.0, 3.2449462890625016, 4.685742187499999]","[-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049]",-10.453417548844534,0.175428184775675,0.17542834295072499,0.175428612672362,0.175428807265387,0.17542889617954,0.17542893177864202,5.551115123125783e-16
24,CIN3+,(todas juntas): ,Treatment for CIN 3 | HPV-negative | NILM,"[0.0, 3.2449462890625016, 4.685742187499999]","[-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049]",-0.6387834786259241,0.000288048962219205,0.0037912398055393298,0.009736625843226439,0.0140039316381632,0.0159476393037477,0.0167247788723049,5.551115123125783e-16
24,CIN3+,(todas juntas): ,Treatment for CIN 3 | HPV-positive | ASC-US/LSIL,"[0.0, 3.2449462890625016, 4.685742187499999]","[-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049]",1.385194490735862,0.102172567414265,0.125711673454009,0.16443615710668202,0.191304726578008,0.20329233727663698,0.20804192662846,5.551115123125783e-16
24,CIN3+,(todas juntas): ,Treatment for CIN 3 | HPV-positive | High Grade,"[0.0, 3.2449462890625016, 4.685742187499999]","[-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049]",2.043030654779511,0.527002022130951,0.550651254477406,0.58828309749054,0.613460217784654,0.624445965439573,0.628756365442339,5.551115123125783e-16
24,CIN3+,(todas juntas): ,Treatment for CIN 3 | HPV-positive | NILM,"[0.0, 3.2449462890625016, 4.685742187499999]","[-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049]",0.7835450827083796,0.058115292449263896,0.0717266377266579,0.09448470144641959,0.11055643859221301,0.117804742530884,0.120690204232158,5.551115123125783e-16
25,CIN2+,label_0: High Grade,Treatment for CIN3 | ASCUS-LSIL HPV-negative,"[0.0, 3.5068246841430617, 4.498048400878903]","[-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275]",0.0,0.00689426072206779,0.0234041056060416,0.050432715718639595,0.0688704714867694,0.0768074028972754,0.07935829582749071,3.3306690738754696e-16
25,CIN2+,label_0: High Grade,Treatment for CIN3 | Cotest-negative,"[0.0, 3.5068246841430617, 4.498048400878903]","[-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275]",-1.171860477937203,0.00116569116099475,0.00633957157518789,0.0149417396800686,0.020907203198276297,0.023500281742851802,0.024336951511278803,3.3306690738754696e-16
25,CIN2+,label_0: High Grade,Treatment for CIN3 | HighGrade,"[0.0, 3.5068246841430617, 4.498048400878903]","[-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275]",0.6664303268151888,0.609348144462981,0.6218948655778039,0.642004999920256,0.655416346620817,0.661112832617304,0.662933846623046,3.3306690738754696e-16
25,CIN2+,label_0: High Grade,Treatment for CIN3 | LowGrade,"[0.0, 3.5068246841430617, 4.498048400878903]","[-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275]",0.9978027150138086,0.148218727717598,0.186081707352701,0.245741894515564,0.284807629791837,0.301222257287978,0.30644683574999404,3.3306690738754696e-16
25,CIN2+,label_0: Low Grade,Treatment for CIN3 | ASCUS-LSIL HPV-negative,"[0.0, 2.75, 5.775]","[-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695]",0.0,0.0491750046718411,0.0637135560502284,0.08407235294447821,0.09678228478318751,0.102804510484527,0.107012417563002,4.996003610813204e-16
25,CIN2+,label_0: Low Grade,Treatment for CIN3 | Cotest-negative,"[0.0, 2.75, 5.775]","[-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695]",-0.7542155007340696,0.00113944145053942,0.00835288281943979,0.0185545319124284,0.024984382853127398,0.028047709175761798,0.0301946136369331,4.996003610813204e-16
25,CIN2+,label_0: Low Grade,Treatment for CIN3 | HighGrade,"[0.0, 2.75, 5.775]","[-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695]",0.3854366675002079,0.505615330492757,0.516689472960763,0.532061385494076,0.541577094082526,0.546063945791907,0.549190652662297,4.996003610813204e-16
25,CIN2+,label_0: Low Grade,Treatment for CIN3 | LowGrade,"[0.0, 2.75, 5.775]","[-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695]",0.8345314151494438,0.16759208587594798,0.196621979175685,0.23629631191997402,0.260489803439742,0.271799493725444,0.27964341551433497,4.996003610813204e-16
25,CIN3+,label_0: High Grade,Treatment for CIN3 | ASCUS-LSIL HPV-negative,"[0.0, 3.093750000000001, 4.949999999999999]","[-11.65621566124099, -4.3784350073280045, -6.399237709979687, -7.520958947104618, -11.54649229806419]",0.0,6.616310929246371e-22,0.00344063446225507,0.00908842803702181,0.0128583636308344,0.014321824844177,0.014659239877557899,3.3306690738754696e-16
25,CIN3+,label_0: High Grade,Treatment for CIN3 | HighGrade,"[0.0, 3.093750000000001, 4.949999999999999]","[-11.65621566124099, -4.3784350073280045, -6.399237709979687, -7.520958947104618, -11.54649229806419]",1.8321853909330095,0.470938641571351,0.482208888835742,0.500271656617588,0.512031663130867,0.516533734139799,0.517566765289406,3.3306690738754696e-16
25,CIN3+,label_0: High Grade,Treatment for CIN3 | LowGrade,"[0.0, 3.093750000000001, 4.949999999999999]","[-11.65621566124099, -4.3784350073280045, -6.399237709979687, -7.520958947104618, -11.54649229806419]",2.048734936225644,0.0791682483413729,0.10346386850759601,0.142135447953194,0.167132789739333,0.17666419487572899,0.17884822315252102,3.3306690738754696e-16
25,CIN3+,label_0: Low Grade,Treatment for CIN3 | ASCUS-LSIL HPV-negative,"[0.0, 3.0239257812500004, 5.2142578125]","[-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101]",0.0,0.016393231121640497,0.0267142535746957,0.0431674882906643,0.0541326061215275,0.05962404507213279,0.0631155908076441,2.220446049250313e-16
25,CIN3+,label_0: Low Grade,Treatment for CIN3 | Cotest-negative,"[0.0, 3.0239257812500004, 5.2142578125]","[-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101]",-1.2834799456120654,0.00056859310178751,0.00348534850162038,0.00818167134838134,0.0113440101892865,0.012937709304145199,0.013954510943629499,2.220446049250313e-16
25,CIN3+,label_0: Low Grade,Treatment for CIN3 | HighGrade,"[0.0, 3.0239257812500004, 5.2142578125]","[-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101]",0.6594645601199031,0.32894402939158196,0.342493691231193,0.363817761773228,0.377840417952489,0.384806371694159,0.389215739325888,2.220446049250313e-16
25,CIN3+,label_0: Low Grade,Treatment for CIN3 | LowGrade,"[0.0, 3.0239257812500004, 5.2142578125]","[-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101]",0.30595946805334373,0.0909136890929964,0.103842681541942,0.12435198959338001,0.13795044713030602,0.144739553455262,0.149048808616415,2.220446049250313e-16
1 table outcome group curve knots gamma eta cr0 cr1 cr2 cr3 cr4 cr5 max_abs
2 1 CIN2+ HPV negativo AGC [0.0, 3.749999999999426, 10.992706060410129] [-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106] 0.0 0.0241115195644835 0.0256092196204436 0.0268181400278813 0.028171784403177 0.0297901538513425 0.031523974593383 4.440892098500626e-16
3 1 CIN2+ HPV negativo ASC-H [0.0, 3.749999999999426, 10.992706060410129] [-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106] 0.675059058469885 0.0953469396720264 0.0980718969717476 0.100268497329922 0.102724939896397 0.10565744916419 0.108793929166055 4.440892098500626e-16
4 1 CIN2+ HPV negativo ASC-US [0.0, 3.749999999999426, 10.992706060410129] [-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106] 0.3716720902899113 0.0006886909862562 0.00291195228696667 0.00470541300218982 0.00671238510720408 0.00911019894943088 0.0116770710796392 4.440892098500626e-16
5 1 CIN2+ HPV negativo HSIL+ [0.0, 3.749999999999426, 10.992706060410129] [-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106] 2.0164005981856348 0.468287640749052 0.474386433098624 0.47926496337816 0.484680892189583 0.491091841584196 0.497883312012614 4.440892098500626e-16
6 1 CIN2+ HPV negativo LSIL [0.0, 3.749999999999426, 10.992706060410129] [-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106] 1.0694381631654704 0.0321089460773336 0.036430742300162 0.0399099701641632 0.0437959045534305 0.0484282146868277 0.05337460404111 4.440892098500626e-16
7 1 CIN2+ HPV negativo NILM [0.0, 3.749999999999426, 10.992706060410129] [-6.324383795005433, -6.37479744714196, -4.735247839134645, -7.506441621422714, -5.286359290355106] -0.6656887215701865 3.90353647266218e-05 0.000828013277650686 0.00146529413171444 0.00217932287701656 0.00303362524453662 0.00394964078320864 4.440892098500626e-16
8 1 CIN2+ HPV positivo AGC [0.0, 3.7291666666669765, 7.200620785886926] [-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466] 0.0 0.400884761372207 0.423177327520334 0.453148774204697 0.47722331054264 0.491809730088738 0.500142601911983 7.771561172376096e-16
9 1 CIN2+ HPV positivo ASC-H [0.0, 3.7291666666669765, 7.200620785886926] [-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466] 0.2126697727739812 0.501106699178966 0.523966961254572 0.554371985820979 0.578511314319372 0.593010085492955 0.601248908320567 7.771561172376096e-16
10 1 CIN2+ HPV positivo ASC-US [0.0, 3.7291666666669765, 7.200620785886926] [-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466] -0.7533953307304859 0.134977733606003 0.150282229405366 0.171360576935273 0.188738761408003 0.19947466518464 0.205681128069832 7.771561172376096e-16
11 1 CIN2+ HPV positivo HSIL+ [0.0, 3.7291666666669765, 7.200620785886926] [-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466] 0.007560314353099129 0.768895742132862 0.777558954414099 0.789202267331941 0.798551251948637 0.80421408879622 0.807448580381107 7.771561172376096e-16
12 1 CIN2+ HPV positivo LSIL [0.0, 3.7291666666669765, 7.200620785886926] [-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466] -0.7121375835534804 0.150720429636477 0.166373432071245 0.187912288999706 0.205652819554319 0.216604598846303 0.222933043955648 7.771561172376096e-16
13 1 CIN2+ HPV positivo NILM [0.0, 3.7291666666669765, 7.200620785886926] [-4.0640514538410475, -1.880658423593201, -5.23057999132761, -3.8132214643020976, -4.486047029509466] -0.9861148498309161 0.0498612570542781 0.0632060742965726 0.0816675057209598 0.0969615559339089 0.106443878949773 0.111937675985206 7.771561172376096e-16
14 1 CIN3+ HPV negativo AGC [0.0, 3.7500000000006812, 7.523483812808309] [-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815] 0.0 0.0106844641637163 0.0115079789994108 0.0121411816481693 0.0128347160639286 0.0136669643759362 0.0145666781897423 3.3306690738754696e-16
15 1 CIN3+ HPV negativo ASC-H [0.0, 3.7500000000006812, 7.523483812808309] [-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815] -0.04872187576775001 0.0342206380443041 0.034986346556643 0.0355751224053339 0.0362200176140623 0.0369939268279508 0.0378306072669854 3.3306690738754696e-16
16 1 CIN3+ HPV negativo ASC-US [0.0, 3.7500000000006812, 7.523483812808309] [-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815] -0.09879946244479822 0.000397811063724171 0.00115163989720337 0.0017313009790938 0.00236623247962954 0.00312821209932418 0.00395202899225357 3.3306690738754696e-16
17 1 CIN3+ HPV negativo HSIL+ [0.0, 3.7500000000006812, 7.523483812808309] [-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815] 2.004887966546689 0.252144671903415 0.256754712682076 0.260282641941786 0.264130077325419 0.268724170611435 0.273662742092822 3.3306690738754696e-16
18 1 CIN3+ HPV negativo LSIL [0.0, 3.7500000000006812, 7.523483812808309] [-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815] 0.8576201610700221 0.0105183209491033 0.0124590219555563 0.013949740055348 0.0155810064976098 0.017536490040242 0.0196479749836111 3.3306690738754696e-16
19 1 CIN3+ HPV negativo NILM [0.0, 3.7500000000006812, 7.523483812808309] [-6.917115440250148, -7.478080654840027, -6.091702497080626, -6.494690725423079, -7.317898593962815] -1.174571179173883 2.28864043889962e-05 0.000280128375297359 0.000478023113087691 0.000694873939389557 0.000955236140567136 0.00123687521303424 3.3306690738754696e-16
20 1 CIN3+ HPV positivo AGC [0.0, 3.7291666666666847, 7.292848376237279] [-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737] 0.0 0.262739413900099 0.276609416274342 0.302317768969549 0.324522607011181 0.338063429715532 0.345343732440977 3.885780586188048e-16
21 1 CIN3+ HPV positivo ASC-H [0.0, 3.7291666666666847, 7.292848376237279] [-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737] -0.09530733394718151 0.25730149160114 0.270014560302542 0.293637521742104 0.314104857280649 0.326616057076886 0.333352370721709 3.885780586188048e-16
22 1 CIN3+ HPV positivo ASC-US [0.0, 3.7291666666666847, 7.292848376237279] [-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737] -1.3767188384949076 0.0444540193603678 0.0490236673279738 0.0576697985578552 0.0653314891820387 0.0700965762622234 0.0726887422509778 3.885780586188048e-16
23 1 CIN3+ HPV positivo HSIL+ [0.0, 3.7291666666666847, 7.292848376237279] [-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737] -0.30370002843403754 0.488648915271303 0.495766893454262 0.509055662871487 0.520636978488655 0.527748325122181 0.531587512570922 3.885780586188048e-16
24 1 CIN3+ HPV positivo LSIL [0.0, 3.7291666666666847, 7.292848376237279] [-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737] -1.4329033456135163 0.042676750204802 0.0470053353775885 0.0551984713012144 0.0624621762259645 0.0669813807353154 0.0694403197238233 3.885780586188048e-16
25 1 CIN3+ HPV positivo NILM [0.0, 3.7291666666666847, 7.292848376237279] [-8.653010231501607, -2.175574663798926, -5.954714336781031, -4.396870683350268, -5.000172264868737] -1.4575108528337812 0.0213187485278357 0.0256365794003271 0.0338106666152414 0.0410589243006993 0.0455692063201592 0.0480235134204469 3.885780586188048e-16
26 17 CIN2+ label_0+label_2: High Grade | HPV-negative <CIN2 | ASC-H/AGC/HSIL+ [0.0, 3.95989990234375, 4.47021484375] [-3.9228738479090945, -2.641724806005263, -3.734740862816677, -4.055863260141345, -4.947911436939447] 0.0 0.123579923952225 0.15102756718187801 0.184365754779829 0.210945417069017 0.227846791207951 0.237559121707946 4.163336342344337e-16
27 17 CIN2+ label_0+label_2: High Grade | HPV-negative <CIN2 | ASC-US/LSIL [0.0, 3.95989990234375, 4.47021484375] [-3.9228738479090945, -2.641724806005263, -3.734740862816677, -4.055863260141345, -4.947911436939447] -1.0672586464162441 0.008007515968007129 0.0188047699694367 0.0322318229603189 0.0431971868013434 0.0502963963549639 0.054422158764861395 4.163336342344337e-16
28 17 CIN2+ label_0+label_2: High Grade | HPV-negative <CIN2 | NILM [0.0, 3.95989990234375, 4.47021484375] [-3.9228738479090945, -2.641724806005263, -3.734740862816677, -4.055863260141345, -4.947911436939447] -2.5402918082419363 0.00021709070750837198 0.00272210458747353 0.00586705802785506 0.00846046698055248 0.0101517369447562 0.0111391137977098 4.163336342344337e-16
29 17 CIN2+ label_0+label_2: High Grade | HPV-positive <CIN2 | ASC-H/AGC/HSIL+ [0.0, 2.75, 5.5] [-3.5065053026338764, -1.8731662048345261, -2.3420581756483396, -3.811317909251368, -4.133916986812303] 0.0 0.539026420832674 0.570211122864893 0.606491135373487 0.634169795753661 0.6511985060144551 0.660783913749291 4.440892098500626e-16
30 17 CIN2+ label_0+label_2: High Grade | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 2.75, 5.5] [-3.5065053026338764, -1.8731662048345261, -2.3420581756483396, -3.811317909251368, -4.133916986812303] -0.319733986184771 0.206897038243222 0.246239084107875 0.293008432352947 0.329486737548833 0.352304022461775 0.365281610981382 4.440892098500626e-16
31 17 CIN2+ label_0+label_2: High Grade | HPV-positive <CIN2 | NILM [0.0, 2.75, 5.5] [-3.5065053026338764, -1.8731662048345261, -2.3420581756483396, -3.811317909251368, -4.133916986812303] -0.6515872090196151 0.09983770568447399 0.132109526744864 0.171100384178412 0.20201930698049397 0.22160052012735001 0.232824345859495 4.440892098500626e-16
32 17 CIN2+ label_0+label_2: Low Grade | HPV-negative <CIN2 | ASC-H/AGC/HSIL+ [0.0, 2.75, 5.5] [-9.60325253538708, -3.7390337694370426, -4.32693762836679, -8.059250158880516, -5.539079202132769] 0.0 0.0818102195529921 0.08816299645362341 0.0994708114947793 0.10864916988177599 0.113888872396136 0.11695548954333301 1.5959455978986625e-16
33 17 CIN2+ label_0+label_2: Low Grade | HPV-negative <CIN2 | ASC-US/LSIL [0.0, 2.75, 5.5] [-9.60325253538708, -3.7390337694370426, -4.32693762836679, -8.059250158880516, -5.539079202132769] -0.032048176979885025 0.0046423195748839605 0.011312529019801001 0.0231890012469638 0.0328323851663901 0.038338961914485596 0.0415622474077153 1.5959455978986625e-16
34 17 CIN2+ label_0+label_2: Low Grade | HPV-negative <CIN2 | NILM [0.0, 2.75, 5.5] [-9.60325253538708, -3.7390337694370426, -4.32693762836679, -8.059250158880516, -5.539079202132769] -0.9340386881343488 6.352805491541261e-05 0.0027879235521406 0.00766594465494657 0.0116527593369533 0.0139399179550898 0.0152823233565092 1.5959455978986625e-16
35 17 CIN2+ label_0+label_2: Low Grade | HPV-positive <CIN2 | ASC-H/AGC/HSIL+ [0.0, 2.8531250000000004, 5.3625] [-7.48294359780084, -1.8089325565913317, -2.494687509379357, -4.681199745539646, -3.882722349957299] 0.0 0.49306433151293594 0.516539536787493 0.556033375006267 0.586032637229327 0.6023693176552191 0.611672827894284 8.881784197001252e-16
36 17 CIN2+ label_0+label_2: Low Grade | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 2.8531250000000004, 5.3625] [-7.48294359780084, -1.8089325565913317, -2.494687509379357, -4.681199745539646, -3.882722349957299] -0.9030074448223038 0.11667547120604099 0.133490367287367 0.162911881278714 0.18631750771560898 0.199489640993048 0.20713523821422497 8.881784197001252e-16
37 17 CIN2+ label_0+label_2: Low Grade | HPV-positive <CIN2 | NILM [0.0, 2.8531250000000004, 5.3625] [-7.48294359780084, -1.8089325565913317, -2.494687509379357, -4.681199745539646, -3.882722349957299] -1.1294181009525135 0.06097283674749279 0.07525408930616 0.100378568900568 0.120493677221056 0.131865432528085 0.138483393848094 8.881784197001252e-16
38 17 CIN2+ label_0: High Grade <CIN2 | HPV-negative | ASC-H/AGC/HSIL+ [0.0, 3.2499999999999982, 8.524999999999997] [-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708] 0.0 0.123579923952225 0.15102756718187801 0.184365754779829 0.210945417069017 0.227846791207951 0.237559121707946 4.440892098500626e-16
39 17 CIN2+ label_0: High Grade <CIN2 | HPV-negative | ASC-US/LSIL [0.0, 3.2499999999999982, 8.524999999999997] [-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708] -1.0672586464162428 0.008007515968007129 0.0188047699694367 0.0322318229603189 0.0431971868013434 0.0502963963549639 0.054422158764861395 4.440892098500626e-16
40 17 CIN2+ label_0: High Grade <CIN2 | HPV-negative | NILM [0.0, 3.2499999999999982, 8.524999999999997] [-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708] -2.5402918082419377 0.00021709070750837198 0.00272210458747353 0.00586705802785506 0.00846046698055248 0.0101517369447562 0.0111391137977098 4.440892098500626e-16
41 17 CIN2+ label_0: High Grade <CIN2 | HPV-positive | ASC-H/AGC/HSIL+ [0.0, 3.2499999999999982, 8.524999999999997] [-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708] 0.7891037999664713 0.539026420832674 0.570211122864893 0.606491135373487 0.634169795753661 0.6511985060144551 0.660783913749291 4.440892098500626e-16
42 17 CIN2+ label_0: High Grade <CIN2 | HPV-positive | ASC-US/LSIL [0.0, 3.2499999999999982, 8.524999999999997] [-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708] 0.46936981378170023 0.206897038243222 0.246239084107875 0.293008432352947 0.329486737548833 0.352304022461775 0.365281610981382 4.440892098500626e-16
43 17 CIN2+ label_0: High Grade <CIN2 | HPV-positive | NILM [0.0, 3.2499999999999982, 8.524999999999997] [-4.122265634159465, -2.1255463991307395, -4.369657957705268, -7.100053626222385, -4.696492375941708] 0.1375165909468566 0.09983770568447399 0.132109526744864 0.171100384178412 0.20201930698049397 0.22160052012735001 0.232824345859495 4.440892098500626e-16
44 17 CIN2+ label_0: Low Grade <CIN2 | HPV-negative | ASC-H/AGC/HSIL+ [0.0, 3.40234375, 6.5203125] [-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177] 0.0 0.0818102195529921 0.08816299645362341 0.0994708114947793 0.10864916988177599 0.113888872396136 0.11695548954333301 6.661338147750939e-16
45 17 CIN2+ label_0: Low Grade <CIN2 | HPV-negative | ASC-US/LSIL [0.0, 3.40234375, 6.5203125] [-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177] -0.032048176979882936 0.0046423195748839605 0.011312529019801001 0.0231890012469638 0.0328323851663901 0.038338961914485596 0.0415622474077153 6.661338147750939e-16
46 17 CIN2+ label_0: Low Grade <CIN2 | HPV-negative | NILM [0.0, 3.40234375, 6.5203125] [-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177] -0.9340386881343479 6.352805491541261e-05 0.0027879235521406 0.00766594465494657 0.0116527593369533 0.0139399179550898 0.0152823233565092 6.661338147750939e-16
47 17 CIN2+ label_0: Low Grade <CIN2 | HPV-positive | ASC-H/AGC/HSIL+ [0.0, 3.40234375, 6.5203125] [-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177] 1.9212169342400942 0.49306433151293594 0.516539536787493 0.556033375006267 0.586032637229327 0.6023693176552191 0.611672827894284 6.661338147750939e-16
48 17 CIN2+ label_0: Low Grade <CIN2 | HPV-positive | ASC-US/LSIL [0.0, 3.40234375, 6.5203125] [-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177] 1.0182094894177909 0.11667547120604099 0.133490367287367 0.162911881278714 0.18631750771560898 0.199489640993048 0.20713523821422497 6.661338147750939e-16
49 17 CIN2+ label_0: Low Grade <CIN2 | HPV-positive | NILM [0.0, 3.40234375, 6.5203125] [-8.888048023332304, -3.366606384789105, -6.291599660352853, -5.405967579947326, -5.825837965415177] 0.7917988332875814 0.06097283674749279 0.07525408930616 0.100378568900568 0.120493677221056 0.131865432528085 0.138483393848094 6.661338147750939e-16
50 17 CIN3+ label_0+label_2: High Grade | HPV-negative <CIN2 | ASC-H/AGC/HSIL+ [0.0, 3.35150480270386, 5.140167140960691] [-11.008186733553266, -2.748795416105142, -4.010248009038462, -4.60664472360736, -6.087336519091521] 0.0 0.056152193511642905 0.0714736818636741 0.0987872766172283 0.120837895850705 0.133591678274714 0.14053180371033702 1.3877787807814457e-16
51 17 CIN3+ label_0+label_2: High Grade | HPV-negative <CIN2 | ASC-US/LSIL [0.0, 3.35150480270386, 5.140167140960691] [-11.008186733553266, -2.748795416105142, -4.010248009038462, -4.60664472360736, -6.087336519091521] -2.189971905541478 0.0028073559928682 0.00463224593407769 0.00795285226750279 0.0106994765123714 0.012316140575016302 0.0132047680498179 1.3877787807814457e-16
52 17 CIN3+ label_0+label_2: High Grade | HPV-negative <CIN2 | NILM [0.0, 3.35150480270386, 5.140167140960691] [-11.008186733553266, -2.748795416105142, -4.010248009038462, -4.60664472360736, -6.087336519091521] -3.0083113846638474 0.000217474670789548 0.00102505375178246 0.00249666617420671 0.00371598505957691 0.00443456123574488 0.00482981907149305 1.3877787807814457e-16
53 17 CIN3+ label_0+label_2: High Grade | HPV-positive <CIN2 | ASC-H/AGC/HSIL+ [0.0, 3.3515625000000027, 5.388281249999999] [-10.54691011249509, -2.240786746752028, -3.632622617326058, -4.17107995201359, -5.755718773586673] 0.0 0.283925046033346 0.302266314811659 0.33452512019192904 0.360154491149052 0.374807893081757 0.382728941543987 4.996003610813204e-16
54 17 CIN3+ label_0+label_2: High Grade | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 3.3515625000000027, 5.388281249999999] [-10.54691011249509, -2.240786746752028, -3.632622617326058, -4.17107995201359, -5.755718773586673] -0.20773512406798625 0.0660029115279839 0.0854856922082638 0.11998776652616999 0.14762324557453899 0.163516655451206 0.172137039735473 4.996003610813204e-16
55 17 CIN3+ label_0+label_2: High Grade | HPV-positive <CIN2 | NILM [0.0, 3.3515625000000027, 5.388281249999999] [-10.54691011249509, -2.240786746752028, -3.632622617326058, -4.17107995201359, -5.755718773586673] -0.7339090471758761 0.0502224880729527 0.061979053698500604 0.08305330055168661 0.100178305176523 0.110129965710093 0.115559974612717 4.996003610813204e-16
56 17 CIN3+ label_0+label_2: Low Grade | HPV-negative <CIN2 | ASC-H/AGC/HSIL+ [0.0, 3.3921875000000004, 6.4796875] [-12.617897003010304, -3.7970179725994324, -6.525658531159966, -6.073030586317113, -6.257924890927562] 0.0 0.0164593639076601 0.020865910131221202 0.0288255780656094 0.0352978662713855 0.0389342494067136 0.040947433590996195 1.1796119636642288e-16
57 17 CIN3+ label_0+label_2: Low Grade | HPV-negative <CIN2 | ASC-US/LSIL [0.0, 3.3921875000000004, 6.4796875] [-12.617897003010304, -3.7970179725994324, -6.525658531159966, -6.073030586317113, -6.257924890927562] -1.0508854390530271 0.00045816445105480803 0.00202616816773695 0.0048701701194103705 0.00719392459035741 0.00850395144411777 0.00923059884268837 1.1796119636642288e-16
58 17 CIN3+ label_0+label_2: Low Grade | HPV-negative <CIN2 | NILM [0.0, 3.3921875000000004, 6.4796875] [-12.617897003010304, -3.7970179725994324, -6.525658531159966, -6.073030586317113, -6.257924890927562] -1.801676728882616 3.1533490176679904e-05 0.0007722429160041671 0.00211729098575043 0.00321779960310556 0.0038388157570307404 0.00418346861821767 1.1796119636642288e-16
59 17 CIN3+ label_0+label_2: Low Grade | HPV-positive <CIN2 | ASC-H/AGC/HSIL+ [0.0, 3.4375000000000027, 4.9499999999999975] [-10.826280746746997, -2.620033444443425, -3.9378457923904575, -4.578177810857306, -5.766887479985344] 0.0 0.22971674078599702 0.244083348646396 0.269516047197888 0.289711503374328 0.300869906443187 0.306989756904408 2.220446049250313e-16
60 17 CIN3+ label_0+label_2: Low Grade | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 3.4375000000000027, 4.9499999999999975] [-10.826280746746997, -2.620033444443425, -3.9378457923904575, -4.578177810857306, -5.766887479985344] -1.2387735560750097 0.0310566408302113 0.0363278167844026 0.0458363669929681 0.053555780922701406 0.0578879736180621 0.0602848606723243 2.220446049250313e-16
61 17 CIN3+ label_0+label_2: Low Grade | HPV-positive <CIN2 | NILM [0.0, 3.4375000000000027, 4.9499999999999975] [-10.826280746746997, -2.620033444443425, -3.9378457923904575, -4.578177810857306, -5.766887479985344] -1.1595249391199973 0.0205211557608812 0.026287808771337698 0.036683552066823805 0.0451169464582727 0.0498473486599558 0.0524637842176785 2.220446049250313e-16
62 17 CIN3+ label_0: High Grade <CIN2 | HPV-negative | ASC-H/AGC/HSIL+ [0.0, 3.3000000000000025, 5.431249999999999] [-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483] 0.0 0.056152193511642905 0.0714736818636741 0.0987872766172283 0.120837895850705 0.133591678274714 0.14053180371033702 4.996003610813204e-16
63 17 CIN3+ label_0: High Grade <CIN2 | HPV-negative | ASC-US/LSIL [0.0, 3.3000000000000025, 5.431249999999999] [-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483] -2.189971905541481 0.0028073559928682 0.00463224593407769 0.00795285226750279 0.0106994765123714 0.012316140575016302 0.0132047680498179 4.996003610813204e-16
64 17 CIN3+ label_0: High Grade <CIN2 | HPV-negative | NILM [0.0, 3.3000000000000025, 5.431249999999999] [-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483] -3.008311384663847 0.000217474670789548 0.00102505375178246 0.00249666617420671 0.00371598505957691 0.00443456123574488 0.00482981907149305 4.996003610813204e-16
65 17 CIN3+ label_0: High Grade <CIN2 | HPV-positive | ASC-H/AGC/HSIL+ [0.0, 3.3000000000000025, 5.431249999999999] [-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483] 0.46085110304222565 0.283925046033346 0.302266314811659 0.33452512019192904 0.360154491149052 0.374807893081757 0.382728941543987 4.996003610813204e-16
66 17 CIN3+ label_0: High Grade <CIN2 | HPV-positive | ASC-US/LSIL [0.0, 3.3000000000000025, 5.431249999999999] [-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483] 0.2531159789742397 0.0660029115279839 0.0854856922082638 0.11998776652616999 0.14762324557453899 0.163516655451206 0.172137039735473 4.996003610813204e-16
67 17 CIN3+ label_0: High Grade <CIN2 | HPV-positive | NILM [0.0, 3.3000000000000025, 5.431249999999999] [-11.51750433879959, -2.7087160287989778, -4.031034504451944, -4.701181851669925, -6.015461348929483] -0.27305794413365025 0.0502224880729527 0.061979053698500604 0.08305330055168661 0.100178305176523 0.110129965710093 0.115559974612717 4.996003610813204e-16
68 17 CIN3+ label_0: Low Grade <CIN2 | HPV-negative | ASC-H/AGC/HSIL+ [0.0, 3.9189535140991256, 4.434260654449458] [-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621] 0.0 0.0164593639076601 0.020865910131221202 0.0288255780656094 0.0352978662713855 0.0389342494067136 0.040947433590996195 2.220446049250313e-16
69 17 CIN3+ label_0: Low Grade <CIN2 | HPV-negative | ASC-US/LSIL [0.0, 3.9189535140991256, 4.434260654449458] [-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621] -1.0508854390530284 0.00045816445105480803 0.00202616816773695 0.0048701701194103705 0.00719392459035741 0.00850395144411777 0.00923059884268837 2.220446049250313e-16
70 17 CIN3+ label_0: Low Grade <CIN2 | HPV-negative | NILM [0.0, 3.9189535140991256, 4.434260654449458] [-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621] -1.8016767288826154 3.1533490176679904e-05 0.0007722429160041671 0.00211729098575043 0.00321779960310556 0.0038388157570307404 0.00418346861821767 2.220446049250313e-16
71 17 CIN3+ label_0: Low Grade <CIN2 | HPV-positive | ASC-H/AGC/HSIL+ [0.0, 3.9189535140991256, 4.434260654449458] [-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621] 1.4333705313265157 0.22971674078599702 0.244083348646396 0.269516047197888 0.289711503374328 0.300869906443187 0.306989756904408 2.220446049250313e-16
72 17 CIN3+ label_0: Low Grade <CIN2 | HPV-positive | ASC-US/LSIL [0.0, 3.9189535140991256, 4.434260654449458] [-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621] 0.19459697525150654 0.0310566408302113 0.0363278167844026 0.0458363669929681 0.053555780922701406 0.0578879736180621 0.0602848606723243 2.220446049250313e-16
73 17 CIN3+ label_0: Low Grade <CIN2 | HPV-positive | NILM [0.0, 3.9189535140991256, 4.434260654449458] [-11.53231335554015, -4.033464618657092, -5.704458893257282, -5.85096328236219, -6.65917891628621] 0.2738455922065207 0.0205211557608812 0.026287808771337698 0.036683552066823805 0.0451169464582727 0.0498473486599558 0.0524637842176785 2.220446049250313e-16
74 18 CIN2+ label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 2.8529907226562505, 4.98558349609375] [-10.34844881940246, -2.24210128461073, -4.564413713372809, -6.455917689788004, -10.613171503266397] 0.0 0.0754015255440931 0.103265794337961 0.145179223258591 0.169473034365134 0.177288570696931 0.17854208342549 5.551115123125783e-16
75 18 CIN2+ label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive <CIN2 | High Grade [0.0, 2.8529907226562505, 4.98558349609375] [-10.34844881940246, -2.24210128461073, -4.564413713372809, -6.455917689788004, -10.613171503266397] 0.7616733125518199 0.499132506342513 0.530907195266614 0.576617975356811 0.60197210394162 0.609951509308618 0.61122329054014 5.551115123125783e-16
76 18 CIN2+ label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive <CIN2 | NILM [0.0, 2.8529907226562505, 4.98558349609375] [-10.34844881940246, -2.24210128461073, -4.564413713372809, -6.455917689788004, -10.613171503266397] -0.8363475431129561 2.38238037242056e-15 0.013171196210381599 0.0334278190860156 0.045427494874570096 0.0493301039184659 0.0499579850656342 5.551115123125783e-16
77 18 CIN2+ label_0+label_2+label_3: High Grade | HPV-negative/ASCUS/LSIL | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 1.993764424324036, 5.465644538402557] [-8.058643072974567, -1.8886850796043781, -1.2230492132635378, -3.60609859472805, -4.573943855420296] 0.0 2.10984399628414e-18 0.0642167383232001 0.18451512993242702 0.288932661609402 0.35257094621844204 0.37886263581951196 3.3306690738754696e-16
78 18 CIN2+ label_0+label_2+label_3: High Grade | HPV-negative/ASCUS/LSIL | HPV-positive <CIN2 | High Grade [0.0, 1.993764424324036, 5.465644538402557] [-8.058643072974567, -1.8886850796043781, -1.2230492132635378, -3.60609859472805, -4.573943855420296] 1.1563566686924174 0.833305441055717 0.865008364666254 0.9128290596846701 0.9436044942776021 0.958137282157014 0.96330532556192 3.3306690738754696e-16
79 18 CIN2+ label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 2.75, 5.5] [-3.9596440054374784, -3.378672278185891, -3.9875232602526585, -3.6722810703457265, -4.280386842686037] 0.0 0.0659044703742194 0.089746688578391 0.109230111875092 0.12529894916311102 0.140192313505222 0.155753880872501 5.551115123125783e-16
80 18 CIN2+ label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive <CIN2 | High Grade [0.0, 2.75, 5.5] [-3.9596440054374784, -3.378672278185891, -3.9875232602526585, -3.6722810703457265, -4.280386842686037] 0.5773343339569103 0.5912195695356339 0.609619591237797 0.6243790956833439 0.636363776097805 0.647319257929656 0.658608929897879 5.551115123125783e-16
81 18 CIN2+ label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive <CIN2 | NILM [0.0, 2.75, 5.5] [-3.9596440054374784, -3.378672278185891, -3.9875232602526585, -3.6722810703457265, -4.280386842686037] -0.9820914167155511 0.0360575716765237 0.0453470409822074 0.0530518709507203 0.0594860854426566 0.0655159757267125 0.07188660783930981 5.551115123125783e-16
82 18 CIN2+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative <CIN2 | ASC-US/LSIL [0.0, 2.75, 5.5] [-20.536131988436342, -4.260644311297781, -3.356872403985886, -4.45548462017129, -5.841778904258112] 0.0 0.0131140716015184 0.018207911105975902 0.0312017894163993 0.047561186468938796 0.0620103077731488 0.0712615583346978 3.3306690738754696e-16
83 18 CIN2+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative <CIN2 | High Grade [0.0, 2.75, 5.5] [-20.536131988436342, -4.260644311297781, -3.356872403985886, -4.45548462017129, -5.841778904258112] -11.455432116776514 0.300073811964724 0.300073850328629 0.300073949099842 0.300074075354672 0.300074188683584 0.30007426216439703 3.3306690738754696e-16
84 18 CIN2+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative <CIN2 | NILM [0.0, 2.75, 5.5] [-20.536131988436342, -4.260644311297781, -3.356872403985886, -4.45548462017129, -5.841778904258112] -1.039851888850465 1.17957341124561e-14 0.00182768948185797 0.006517879154542669 0.012481064395005601 0.0178032520807647 0.021238743258582802 3.3306690738754696e-16
85 18 CIN2+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 2.749972265958786, 5.499840152263641] [-19.34733193429554, -4.88827911091044, -3.9845120611245077, -5.082976995007613, -6.469267687925621] 0.0 0.07351057572352189 0.07606669896412671 0.08261525750923729 0.0909184496853561 0.098307541381759 0.10306639528883099 3.3306690738754696e-16
86 18 CIN2+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-positive <CIN2 | High Grade [0.0, 2.749972265958786, 5.499840152263641] [-19.34733193429554, -4.88827911091044, -3.9845120611245077, -5.082976995007613, -6.469267687925621] 4.061397297742704 0.230831397902068 0.3448148392882 0.5664644165634131 0.7442690505691949 0.840774931785191 0.8828905441660799 3.3306690738754696e-16
87 18 CIN2+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-positive <CIN2 | NILM [0.0, 2.749972265958786, 5.499840152263641] [-19.34733193429554, -4.88827911091044, -3.9845120611245077, -5.082976995007613, -6.469267687925621] 0.9425976641150026 0.036133527238391 0.0429441067797216 0.060257919509119004 0.08193408722379729 0.10096490141836799 0.11309287374098201 3.3306690738754696e-16
88 18 CIN3+ label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 2.8187500000000014, 4.88125] [-21.931975912646944, -19.932014656863323, -21.959260875279913, -24.216762631029734, -25.901625072089512] 0.0 0.018868845497754902 0.0188688463833303 0.0188688474376925 0.0188688480451513 0.0188688482436359 0.0188688482756456 3.3306690738754696e-16
89 18 CIN3+ label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive <CIN2 | High Grade [0.0, 2.8187500000000014, 4.88125] [-21.931975912646944, -19.932014656863323, -21.959260875279913, -24.216762631029734, -25.901625072089512] 18.299272734135396 0.49755217974530097 0.5361550132958299 0.578266941318611 0.60077031262867 0.607859732457989 0.608991201389804 3.3306690738754696e-16
90 18 CIN3+ label_0+label_2+label_3: High Grade | Cotest-negative | HPV-positive <CIN2 | NILM [0.0, 2.8187500000000014, 4.88125] [-21.931975912646944, -19.932014656863323, -21.959260875279913, -24.216762631029734, -25.901625072089512] 16.680005520674186 7.72700650525083e-14 0.0157072262649549 0.03408677208965 0.0445196994119019 0.0479041281479215 0.0484488140137436 3.3306690738754696e-16
91 18 CIN3+ label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive <CIN2 | ASC-US/LSIL [0.0, 3.2656250000000018, 5.568750000000001] [-11.005120843490367, -4.072537754707295, -5.0977913217951665, -4.988725499836527, -6.606418997592393] 0.0 0.0112275700334512 0.015367350846191199 0.023149001780099397 0.030254251011826997 0.0356877959932409 0.0400104534558627 3.608224830031759e-16
92 18 CIN3+ label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive <CIN2 | High Grade [0.0, 3.2656250000000018, 5.568750000000001] [-11.005120843490367, -4.072537754707295, -5.0977913217951665, -4.988725499836527, -6.606418997592393] 1.1781712219333076 0.157836568529019 0.169236578546972 0.19037560996425398 0.20934934334176 0.223649651775841 0.23489762154274 3.608224830031759e-16
93 18 CIN3+ label_0+label_2+label_3: Low Grade | Cotest-negative | HPV-positive <CIN2 | NILM [0.0, 3.2656250000000018, 5.568750000000001] [-11.005120843490367, -4.072537754707295, -5.0977913217951665, -4.988725499836527, -6.606418997592393] -0.5125493120224014 0.010348964132360201 0.0128328458157558 0.0175132256919939 0.0217998505127751 0.0250864342949192 0.0277063839176718 3.608224830031759e-16
94 18 CIN3+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative <CIN2 | ASC-US/LSIL [0.0, 3.473531723022455, 4.096420288085933] [-9.852766225403219, -5.348005437798218, -9.227888582465996, -8.275788592809148, -9.138133904340833] 0.0 0.006557383449894349 0.00795848645101952 0.010099205818607 0.0113355021822377 0.0117227067039258 0.0117796357536864 5.551115123125783e-17
95 18 CIN3+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative <CIN2 | High Grade [0.0, 3.473531723022455, 4.096420288085933] [-9.852766225403219, -5.348005437798218, -9.227888582465996, -8.275788592809148, -9.138133904340833] -11.266547261922307 0.0999947153911425 0.09999473164211899 0.099994756516062 0.0999947709056376 0.0999947754161124 0.0999947760794175 5.551115123125783e-17
96 18 CIN3+ label_0+label_2+label_3: Low Grade | HPV-negative/ASCUS/LSIL | HPV-negative <CIN2 | NILM [0.0, 3.473531723022455, 4.096420288085933] [-9.852766225403219, -5.348005437798218, -9.227888582465996, -8.275788592809148, -9.138133904340833] -0.5297140871380742 3.5738078826717895e-35 0.000830618074109002 0.00210063628986212 0.00283460464295726 0.00306455905801228 0.00309837141083125 5.551115123125783e-17
97 18 CIN3+ label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL <CIN2 | HPV-negative | ASC-US/LSIL [0.0, 2.7500272259116176, 5.281872798502446] [-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774] 0.0 0.006557383449894349 0.00795848645101952 0.010099205818607 0.0113355021822377 0.0117227067039258 0.0117796357536864 2.4216739724636227e-15
98 18 CIN3+ label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL <CIN2 | HPV-negative | High Grade [0.0, 2.7500272259116176, 5.281872798502446] [-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774] -11.266547261886572 0.0999947153911425 0.09999473164211899 0.099994756516062 0.0999947709056376 0.0999947754161124 0.0999947760794175 2.4216739724636227e-15
99 18 CIN3+ label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL <CIN2 | HPV-negative | NILM [0.0, 2.7500272259116176, 5.281872798502446] [-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774] -0.5297140871380728 3.5738078826717895e-35 0.000830618074109002 0.00210063628986212 0.00283460464295726 0.00306455905801228 0.00309837141083125 2.4216739724636227e-15
100 18 CIN3+ label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL <CIN2 | HPV-positive | ASC-US/LSIL [0.0, 2.7500272259116176, 5.281872798502446] [-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774] -27.299467870607586 0.0147068843215046 0.0147068843215059 0.0147068843215079 0.014706884321509 0.0147068843215093 0.014706884321509399 2.4216739724636227e-15
101 18 CIN3+ label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL <CIN2 | HPV-positive | High Grade [0.0, 2.7500272259116176, 5.281872798502446] [-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774] 4.4558478579098715 0.0769197677445438 0.182575885831324 0.321353903291499 0.39060597796332 0.410823095045538 0.413739088439336 2.4216739724636227e-15
102 18 CIN3+ label_0+label_2: Low Grade | HPV-negative/ASCUS/LSIL <CIN2 | HPV-positive | NILM [0.0, 2.7500272259116176, 5.281872798502446] [-19.74001165167534, -5.285936631490191, -8.513690926779626, -11.736464163463973, -15.062291758785774] 1.3214479115965938 5.106044319392471e-40 0.00527694836759951 0.0133000310093961 0.017911804765725802 0.0193529432788598 0.019564696974458298 2.4216739724636227e-15
103 24 CIN2+ label_1: HPV-negative Treatment for CIN 3 | ASC-US/LSIL [0.0, 3.0250000000000004, 5.225] [-5.970564123896623, -2.9583893638499363, -4.516974672861336, -5.780793455732832, -6.209824875259012] 0.0 0.0262214431467089 0.0416928080114781 0.0646927106456137 0.0807470937165037 0.08826314484108369 0.0917702560686117 4.163336342344337e-16
104 24 CIN2+ label_1: HPV-negative Treatment for CIN 3 | High Grade [0.0, 3.0250000000000004, 5.225] [-5.970564123896623, -2.9583893638499363, -4.516974672861336, -5.780793455732832, -6.209824875259012] -10.729002075719931 0.21056564309331802 0.21056591998573299 0.21056633999139301 0.210566639329971 0.21056678127012798 0.21056684790255598 4.163336342344337e-16
105 24 CIN2+ label_1: HPV-negative Treatment for CIN 3 | NILM [0.0, 3.0250000000000004, 5.225] [-5.970564123896623, -2.9583893638499363, -4.516974672861336, -5.780793455732832, -6.209824875259012] -0.9535043052028737 0.00114916052911648 0.0072952786692584305 0.0165459402914708 0.023086242714399397 0.026172299707561398 0.0276176550475499 4.163336342344337e-16
106 24 CIN2+ label_1: HPV-positive Treatment for CIN 3 | ASC-US/LSIL [0.0, 2.8875, 5.225] [-4.909963766900336, -1.87064845459847, -3.1538174160037586, -5.191561600237883, -4.820452622627722] 0.0 0.21346052558124298 0.25135818692788603 0.305386982153937 0.341496774219641 0.35795709489185595 0.365541687427744 4.440892098500626e-16
107 24 CIN2+ label_1: HPV-positive Treatment for CIN 3 | High Grade [0.0, 2.8875, 5.225] [-4.909963766900336, -1.87064845459847, -3.1538174160037586, -5.191561600237883, -4.820452622627722] 0.4241078676772622 0.718841415723524 0.7392788126726241 0.7674794483957981 0.785696434253688 0.793828658616323 0.797539091168836 4.440892098500626e-16
108 24 CIN2+ label_1: HPV-positive Treatment for CIN 3 | NILM [0.0, 2.8875, 5.225] [-4.909963766900336, -1.87064845459847, -3.1538174160037586, -5.191561600237883, -4.820452622627722] -0.2934210941211471 0.08629421216615149 0.11932921444308199 0.167172915569126 0.199676460972488 0.214642521254526 0.22157134454827 4.440892098500626e-16
109 24 CIN2+ (todas juntas): Treatment for CIN 3 | HPV-negative | ASC-US/LSIL [0.0, 3.0392578124999985, 6.147070312500004] [-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997] 0.0 0.0262214431467089 0.0416928080114781 0.0646927106456137 0.0807470937165037 0.08826314484108369 0.0917702560686117 4.440892098500626e-16
110 24 CIN2+ (todas juntas): Treatment for CIN 3 | HPV-negative | High Grade [0.0, 3.0392578124999985, 6.147070312500004] [-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997] -10.729002075702507 0.21056564309331802 0.21056591998573299 0.21056633999139301 0.210566639329971 0.21056678127012798 0.21056684790255598 4.440892098500626e-16
111 24 CIN2+ (todas juntas): Treatment for CIN 3 | HPV-negative | NILM [0.0, 3.0392578124999985, 6.147070312500004] [-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997] -0.9535043052028733 0.00114916052911648 0.0072952786692584305 0.0165459402914708 0.023086242714399397 0.026172299707561398 0.0276176550475499 4.440892098500626e-16
112 24 CIN2+ (todas juntas): Treatment for CIN 3 | HPV-positive | ASC-US/LSIL [0.0, 3.0392578124999985, 6.147070312500004] [-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997] 1.126031972593485 0.21346052558124298 0.25135818692788603 0.305386982153937 0.341496774219641 0.35795709489185595 0.365541687427744 4.440892098500626e-16
113 24 CIN2+ (todas juntas): Treatment for CIN 3 | HPV-positive | High Grade [0.0, 3.0392578124999985, 6.147070312500004] [-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997] 1.550139840270747 0.718841415723524 0.7392788126726241 0.7674794483957981 0.785696434253688 0.793828658616323 0.797539091168836 4.440892098500626e-16
114 24 CIN2+ (todas juntas): Treatment for CIN 3 | HPV-positive | NILM [0.0, 3.0392578124999985, 6.147070312500004] [-5.96423984634528, -2.791937776700103, -5.553638795339543, -6.227771274064003, -5.259712198998997] 0.8326108784723378 0.08629421216615149 0.11932921444308199 0.167172915569126 0.199676460972488 0.214642521254526 0.22157134454827 4.440892098500626e-16
115 24 CIN3+ label_1: HPV-negative Treatment for CIN 3 | ASC-US/LSIL [0.0, 3.2656250000000018, 4.674999999999999] [-10.75052455883268, -3.7407644366146644, -5.366941921959517, -6.1266345031929, -7.140714307357668] 0.0 0.00749275883282888 0.0140702718574874 0.0251859308624384 0.0331275183226566 0.036734651218946104 0.0381750857365055 2.220446049250313e-16
116 24 CIN3+ label_1: HPV-negative Treatment for CIN 3 | High Grade [0.0, 3.2656250000000018, 4.674999999999999] [-10.75052455883268, -3.7407644366146644, -5.366941921959517, -6.1266345031929, -7.140714307357668] -10.453417548881681 0.175428184775675 0.17542834295072499 0.175428612672362 0.175428807265387 0.17542889617954 0.17542893177864202 2.220446049250313e-16
117 24 CIN3+ label_1: HPV-negative Treatment for CIN 3 | NILM [0.0, 3.2656250000000018, 4.674999999999999] [-10.75052455883268, -3.7407644366146644, -5.366941921959517, -6.1266345031929, -7.140714307357668] -0.6387834786259222 0.000288048962219205 0.0037912398055393298 0.009736625843226439 0.0140039316381632 0.0159476393037477 0.0167247788723049 2.220446049250313e-16
118 24 CIN3+ label_1: HPV-positive Treatment for CIN 3 | ASC-US/LSIL [0.0, 3.2656250000000018, 4.674999999999999] [-9.365330068085091, -2.3555699458788215, -3.9817474312236376, -4.741440012456921, -5.7555198166218045] 0.0 0.102172567414265 0.125711673454009 0.16443615710668202 0.191304726578008 0.20329233727663698 0.20804192662846 5.551115123125783e-16
119 24 CIN3+ label_1: HPV-positive Treatment for CIN 3 | High Grade [0.0, 3.2656250000000018, 4.674999999999999] [-9.365330068085091, -2.3555699458788215, -3.9817474312236376, -4.741440012456921, -5.7555198166218045] 0.65783616404365 0.527002022130951 0.550651254477406 0.58828309749054 0.613460217784654 0.624445965439573 0.628756365442339 5.551115123125783e-16
120 24 CIN3+ label_1: HPV-positive Treatment for CIN 3 | NILM [0.0, 3.2656250000000018, 4.674999999999999] [-9.365330068085091, -2.3555699458788215, -3.9817474312236376, -4.741440012456921, -5.7555198166218045] -0.6016494080274817 0.058115292449263896 0.0717266377266579 0.09448470144641959 0.11055643859221301 0.117804742530884 0.120690204232158 5.551115123125783e-16
121 24 CIN3+ (todas juntas): Treatment for CIN 3 | HPV-negative | ASC-US/LSIL [0.0, 3.2449462890625016, 4.685742187499999] [-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049] 0.0 0.00749275883282888 0.0140702718574874 0.0251859308624384 0.0331275183226566 0.036734651218946104 0.0381750857365055 5.551115123125783e-16
122 24 CIN3+ (todas juntas): Treatment for CIN 3 | HPV-negative | High Grade [0.0, 3.2449462890625016, 4.685742187499999] [-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049] -10.453417548844534 0.175428184775675 0.17542834295072499 0.175428612672362 0.175428807265387 0.17542889617954 0.17542893177864202 5.551115123125783e-16
123 24 CIN3+ (todas juntas): Treatment for CIN 3 | HPV-negative | NILM [0.0, 3.2449462890625016, 4.685742187499999] [-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049] -0.6387834786259241 0.000288048962219205 0.0037912398055393298 0.009736625843226439 0.0140039316381632 0.0159476393037477 0.0167247788723049 5.551115123125783e-16
124 24 CIN3+ (todas juntas): Treatment for CIN 3 | HPV-positive | ASC-US/LSIL [0.0, 3.2449462890625016, 4.685742187499999] [-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049] 1.385194490735862 0.102172567414265 0.125711673454009 0.16443615710668202 0.191304726578008 0.20329233727663698 0.20804192662846 5.551115123125783e-16
125 24 CIN3+ (todas juntas): Treatment for CIN 3 | HPV-positive | High Grade [0.0, 3.2449462890625016, 4.685742187499999] [-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049] 2.043030654779511 0.527002022130951 0.550651254477406 0.58828309749054 0.613460217784654 0.624445965439573 0.628756365442339 5.551115123125783e-16
126 24 CIN3+ (todas juntas): Treatment for CIN 3 | HPV-positive | NILM [0.0, 3.2449462890625016, 4.685742187499999] [-10.844088333095861, -3.744491191548657, -5.3380576060538, -6.14859693806409, -7.139654756162049] 0.7835450827083796 0.058115292449263896 0.0717266377266579 0.09448470144641959 0.11055643859221301 0.117804742530884 0.120690204232158 5.551115123125783e-16
127 25 CIN2+ label_0: High Grade Treatment for CIN3 | ASCUS-LSIL HPV-negative [0.0, 3.5068246841430617, 4.498048400878903] [-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275] 0.0 0.00689426072206779 0.0234041056060416 0.050432715718639595 0.0688704714867694 0.0768074028972754 0.07935829582749071 3.3306690738754696e-16
128 25 CIN2+ label_0: High Grade Treatment for CIN3 | Cotest-negative [0.0, 3.5068246841430617, 4.498048400878903] [-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275] -1.171860477937203 0.00116569116099475 0.00633957157518789 0.0149417396800686 0.020907203198276297 0.023500281742851802 0.024336951511278803 3.3306690738754696e-16
129 25 CIN2+ label_0: High Grade Treatment for CIN3 | HighGrade [0.0, 3.5068246841430617, 4.498048400878903] [-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275] 0.6664303268151888 0.609348144462981 0.6218948655778039 0.642004999920256 0.655416346620817 0.661112832617304 0.662933846623046 3.3306690738754696e-16
130 25 CIN2+ label_0: High Grade Treatment for CIN3 | LowGrade [0.0, 3.5068246841430617, 4.498048400878903] [-8.596411927947557, -2.7827500664139877, -5.123368036297188, -5.04140686733415, -6.6509943777656275] 0.9978027150138086 0.148218727717598 0.186081707352701 0.245741894515564 0.284807629791837 0.301222257287978 0.30644683574999404 3.3306690738754696e-16
131 25 CIN2+ label_0: Low Grade Treatment for CIN3 | ASCUS-LSIL HPV-negative [0.0, 2.75, 5.775] [-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695] 0.0 0.0491750046718411 0.0637135560502284 0.08407235294447821 0.09678228478318751 0.102804510484527 0.107012417563002 4.996003610813204e-16
132 25 CIN2+ label_0: Low Grade Treatment for CIN3 | Cotest-negative [0.0, 2.75, 5.775] [-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695] -0.7542155007340696 0.00113944145053942 0.00835288281943979 0.0185545319124284 0.024984382853127398 0.028047709175761798 0.0301946136369331 4.996003610813204e-16
133 25 CIN2+ label_0: Low Grade Treatment for CIN3 | HighGrade [0.0, 2.75, 5.775] [-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695] 0.3854366675002079 0.505615330492757 0.516689472960763 0.532061385494076 0.541577094082526 0.546063945791907 0.549190652662297 4.996003610813204e-16
134 25 CIN2+ label_0: Low Grade Treatment for CIN3 | LowGrade [0.0, 2.75, 5.775] [-6.201392856810505, -2.9340273490511635, -6.621741705447746, -5.207340087226381, -5.221145417911695] 0.8345314151494438 0.16759208587594798 0.196621979175685 0.23629631191997402 0.260489803439742 0.271799493725444 0.27964341551433497 4.996003610813204e-16
135 25 CIN3+ label_0: High Grade Treatment for CIN3 | ASCUS-LSIL HPV-negative [0.0, 3.093750000000001, 4.949999999999999] [-11.65621566124099, -4.3784350073280045, -6.399237709979687, -7.520958947104618, -11.54649229806419] 0.0 6.616310929246371e-22 0.00344063446225507 0.00908842803702181 0.0128583636308344 0.014321824844177 0.014659239877557899 3.3306690738754696e-16
136 25 CIN3+ label_0: High Grade Treatment for CIN3 | HighGrade [0.0, 3.093750000000001, 4.949999999999999] [-11.65621566124099, -4.3784350073280045, -6.399237709979687, -7.520958947104618, -11.54649229806419] 1.8321853909330095 0.470938641571351 0.482208888835742 0.500271656617588 0.512031663130867 0.516533734139799 0.517566765289406 3.3306690738754696e-16
137 25 CIN3+ label_0: High Grade Treatment for CIN3 | LowGrade [0.0, 3.093750000000001, 4.949999999999999] [-11.65621566124099, -4.3784350073280045, -6.399237709979687, -7.520958947104618, -11.54649229806419] 2.048734936225644 0.0791682483413729 0.10346386850759601 0.142135447953194 0.167132789739333 0.17666419487572899 0.17884822315252102 3.3306690738754696e-16
138 25 CIN3+ label_0: Low Grade Treatment for CIN3 | ASCUS-LSIL HPV-negative [0.0, 3.0239257812500004, 5.2142578125] [-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101] 0.0 0.016393231121640497 0.0267142535746957 0.0431674882906643 0.0541326061215275 0.05962404507213279 0.0631155908076441 2.220446049250313e-16
139 25 CIN3+ label_0: Low Grade Treatment for CIN3 | Cotest-negative [0.0, 3.0239257812500004, 5.2142578125] [-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101] -1.2834799456120654 0.00056859310178751 0.00348534850162038 0.00818167134838134 0.0113440101892865 0.012937709304145199 0.013954510943629499 2.220446049250313e-16
140 25 CIN3+ label_0: Low Grade Treatment for CIN3 | HighGrade [0.0, 3.0239257812500004, 5.2142578125] [-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101] 0.6594645601199031 0.32894402939158196 0.342493691231193 0.363817761773228 0.377840417952489 0.384806371694159 0.389215739325888 2.220446049250313e-16
141 25 CIN3+ label_0: Low Grade Treatment for CIN3 | LowGrade [0.0, 3.0239257812500004, 5.2142578125] [-9.032473598361769, -3.2280057531071598, -6.183553694822977, -5.077619931052827, -6.782439103358101] 0.30595946805334373 0.0909136890929964 0.103842681541942 0.12435198959338001 0.13795044713030602 0.144739553455262 0.149048808616415 2.220446049250313e-16
+51 -16
View File
@@ -37,7 +37,7 @@ CONFIG = SCENARIO.config
WINDOW = {"recruitment_start": "2018-01-01", "recruitment_end": "2027-01-01", "cutoff": CUTOFF.isoformat()}
LINEAGE = {"url": "cacu/cohorte_total", "datos_as_of": CUTOFF.isoformat(), "parametros": json.dumps(WINDOW)}
N = 240
QUICK = {**CONFIG, "survival": {**CONFIG["survival"], "n_boot": 20, "ks_max_seconds": 5}}
QUICK = {**CONFIG, "survival": {**CONFIG["survival"], "n_boot": 20, "ks_max_seconds": 5}, "risk_interval_replicas": 20}
def _row(pac_id, when, tipo, valor=None, source="t", source_id=None, first=None):
@@ -71,8 +71,9 @@ def cohort_frame():
"""240 members, each with her birth, an old normal cotest, a latest cytology 1-6 months before her diagnosis (NILM,
LSIL or HSIL+; HPV positive or not), a CIS biopsy before the diagnosis for some, the diagnosis (a biopsy reported
as invasive carcinoma) in 2018-2020 and, if she dies by the cut-off, her death: exponential in months, faster with
HSIL+ and with a positive HPV. Members 241 to 244 must be left out: a CIS biopsy only (no index), no birth date
(`sin_nacimiento`), a death before the diagnosis (`defuncion_hasta_el_indice`), a diagnosis before the window."""
HSIL+ and with a positive HPV. Member 241 has a CIS biopsy only, which is her diagnosis (in situ counts); members
242 to 244 must be left out: no birth date (`sin_nacimiento`), a death before the diagnosis
(`defuncion_hasta_el_indice`), a diagnosis before the window."""
rng = np.random.default_rng(5)
rows = []
for pac_id in range(1, N + 1):
@@ -129,22 +130,33 @@ def test_the_graph_takes_exactly_its_config_and_the_cohort():
assert required == {"source_cohort", "cohort_lineage", "age_cuts", "cytology", "etiquetas", "horizons_years",
"index", "survival", "train_fraction"}
# `index` is required: the registered model re-indexes a build with it.
assert optional == {"calibration_bins", "report_panels"}
assert optional == {"calibration_bins", "report_panels", "risk_interval_level", "risk_interval_replicas"}
def _primer_carcinoma(frame: pd.DataFrame) -> pd.Series:
"""Each member's first biopsy reported as carcinoma, in situ or invasive: the survival scenario's diagnosis."""
biopsias = frame[(frame["tipo"] == "biopsia") & frame["valor_codigo"].isin(["CIS", "CARCINOMA"])]
return biopsias.groupby("pac_id")["fecha"].min()
def test_the_index_is_the_first_carcinoma_biopsy_and_its_rules_leave_out_who_they_should(cohort_frame):
"""Pins down the provisional index: members 1 to 240 are indexed at their biopsy reported as invasive carcinoma, not
at an earlier CIS biopsy nor at their first observation; a CIS biopsy only (241), no birth date (242), a death
before the diagnosis (243) and a diagnosis before the window (244) leave the cohort. Fails if the scenario stops
taking `[config.index]`, counts in situ as the diagnosis, or takes the window from elsewhere than the lineage."""
"""Pins down the provisional index: each member is indexed at her first biopsy reported as carcinoma, in situ or
invasive, not at her first observation: an earlier CIS biopsy is the diagnosis (member 5), and a CIS biopsy only
(241) is a case too; no birth date (242), a death before the diagnosis (243) and a diagnosis before the window
(244) leave the cohort. Fails if the scenario stops taking `[config.index]`, drops in situ from the diagnosis, or
takes the window from elsewhere than the lineage."""
attrition = dict(indexing.index_attrition(cohort_frame, LINEAGE, CONFIG["index"]))
indexed = _indexed(cohort_frame)
assert set(indexed["pac_id"].unique()) == set(range(1, N + 1))
assert attrition["sin_nacimiento"] == N + 1 and attrition["defuncion_hasta_el_indice"] == N
# a CIS 20 days before a diagnosis at the window's start puts that member's diagnosis before the window
inicio = date.fromisoformat(WINDOW["recruitment_start"])
antes = set(_primer_carcinoma(cohort_frame)[lambda d: d < inicio].index) & set(range(1, N + 1))
assert set(indexed["pac_id"].unique()) == (set(range(1, N + 1)) | {241}) - antes
assert attrition["sin_nacimiento"] == N + 2 - len(antes)
assert attrition["defuncion_hasta_el_indice"] == N + 1 - len(antes)
five = cohort_frame[cohort_frame["pac_id"] == 5]
diagnosis = five[(five["tipo"] == "biopsia") & (five["valor_codigo"] == "CARCINOMA")]["fecha"].iloc[0]
assert indexed[indexed["pac_id"] == 5]["fecha_indice"].iloc[0] == diagnosis
in_situ = five[(five["tipo"] == "biopsia") & (five["valor_codigo"] == "CIS")]["fecha"].iloc[0]
assert indexed[indexed["pac_id"] == 5]["fecha_indice"].iloc[0] == in_situ
def test_the_covariates_are_the_most_recent_observations_up_to_the_diagnosis(cohort_frame):
@@ -207,8 +219,9 @@ def test_the_dataflow_reaches_its_metrics_routines_and_population_record_without
def test_training_registers_a_version_and_estimating_dates_each_risk_by_the_models_index(cohort_file, mlflow_tracking,
tmp_path):
"""Pins down: training on a build's file registers a version with its population record; estimating with it writes
one row per scored member and horizon, dated by the model's index (the carcinoma biopsy), with the members the
scenario leaves out absent. Fails if the version cannot score a build or the estimate keeps the cohort's index."""
one row per scored member and horizon, dated by the model's index (the carcinoma biopsy), with its combination's
bootstrap interval holding it, and with the members the scenario leaves out absent. Fails if the version cannot
score a build, the estimate keeps the cohort's index, or the risks lose their interval."""
version = train(dataclasses.replace(SCENARIO, config=QUICK), CohortFile(cohort_file))
output = tmp_path / "estimate.parquet"
@@ -216,9 +229,15 @@ def test_training_registers_a_version_and_estimating_dates_each_risk_by_the_mode
assert wrote and resolved.version == version
files = [f["path"] for f in registry.artifacts("cacu", "survival", version)]
assert {"analisis/curvas.json", "analisis/subgrupos.json", "reportes/subgrupos.html"} <= set(files)
assert {"analisis/curvas.json", "analisis/subgrupos.json", "reportes/subgrupos.html", "diagramas/pipeline.dot",
"diagramas/pipeline.svg"} <= set(files)
risks = pq.read_table(output).to_pandas()
assert set(risks["horizonte_anios"]) == {1.0, 3.0, 5.0} and set(risks["pac_id"]) == set(range(1, N + 1))
inicio = date.fromisoformat(WINDOW["recruitment_start"])
antes = set(_primer_carcinoma(read_cohort(cohort_file))[lambda d: d < inicio].index)
assert set(risks["horizonte_anios"]) == {1.0, 3.0, 5.0}
assert risks[["ic_bajo", "ic_alto"]].notna().all().all()
assert ((risks["ic_bajo"] <= risks["probabilidad"]) & (risks["probabilidad"] <= risks["ic_alto"])).mean() > 0.9
assert set(risks["pac_id"]) == (set(range(1, N + 1)) | {241}) - antes
frame = read_cohort(cohort_file)
diagnosis = frame[(frame["tipo"] == "biopsia") & (frame["valor_codigo"] == "CARCINOMA") & (frame["pac_id"] == 1)]
assert risks[risks["pac_id"] == 1]["fecha_indice"].iloc[0] == diagnosis["fecha"].iloc[0]
@@ -280,3 +299,19 @@ def test_the_subgroup_notebook_runs_on_a_builds_file(cohort_file, monkeypatch):
found = _run_notebook(path, cohort_file, "cacu", "survival", monkeypatch)
assert sum(r["n"] for r in found["survival"]) == N
def test_the_survival_scenario_shows_the_probability_of_surviving():
"""Pins down: the scenario's estimand names the probability of surviving and marks it as the complement of the
model's number (the probability of dying), so the patient's record shows survival, with its covariates. Fails if
`complement` is dropped: the record would show a death probability labelled as survival."""
estimand = Scenario.load("cacu", "survival").estimand
assert estimand["quantity"] == "Probabilidad de supervivencia" and estimand["complement"] == "supervivencia"
assert estimand["index_date"] == "la primera biopsia con carcinoma invasor o in situ"
assert "VPH" in estimand["covariates"]
def test_a_survival_case_is_a_carcinoma_invasive_or_in_situ():
"""Pins down: the survival scenario's index is the first biopsy of CIS or invasive carcinoma, so in situ cases are
followed too. Fails if CIS drops out of the index, which would leave its patients without a survival estimate."""
assert Scenario.load("cacu", "survival").config["index"]["event_grades"] == ["CIS", "CARCINOMA"]
+54
View File
@@ -0,0 +1,54 @@
"""What this module covers: the `cancer_pim` scenario, the surveillance PIM with carcinoma as the outcome, through its
dataflow and its registered model.
Fixtures: `cohort_frame`, members of `test_cin2_pim`'s design whose CIN2+ biopsies are carcinomas for a part of them.
"""
import numpy as np
import pandas as pd
import pytest
from models.cacu.cin2_pim import model
from models.dags import training
from tests.cacu.test_cin2_pim import cohort_frame as cin2_cohort_frame # noqa: F401
SCENARIO = training.Scenario.load("cacu", "cancer_pim")
SURVEILLANCE = training.Scenario.load("cacu", "cin2_pim")
@pytest.fixture
def cohort_frame(cin2_cohort_frame): # noqa: F811
"""`test_cin2_pim`'s members with every third LIEAG biopsy reported as carcinoma."""
frame = cin2_cohort_frame.copy()
lieag = frame.index[(frame["tipo"] == "biopsia") & (frame["valor_codigo"] == "LIEAG")]
frame.loc[lieag[::3], "valor_codigo"] = "CARCINOMA"
return frame
def test_the_scenario_is_the_surveillance_model_with_carcinoma_as_the_outcome():
"""Pins down: same dataflow, cohort, index and prediction index as the CIN2+ surveillance model, with carcinoma as
the only event, so the patient's two risks speak of the same visit. Fails if the scenarios drift apart."""
assert SCENARIO.config["event_grades"] == ["CARCINOMA"] == SCENARIO.config["index"]["event_grades"]
assert SCENARIO.outcome == "cancer" and SCENARIO.cohort == SURVEILLANCE.cohort
assert [m.__name__ for m in SCENARIO.modules] == [m.__name__ for m in SURVEILLANCE.modules]
same = {k: v for k, v in SCENARIO.config.items() if k not in ("event_grades", "index")}
assert same == {k: v for k, v in SURVEILLANCE.config.items() if k not in ("event_grades", "index")}
assert SCENARIO.estimand["outcome"].startswith("Cáncer")
def test_the_dataflow_counts_only_carcinomas_as_events(cohort_frame):
"""Pins down: a LIEAG biopsy is not a case for this scenario, and the registered model gives a cancer risk no
higher than the CIN2+ model's at the same visit. Fails if `event_grades` stops reaching the coding."""
run = training.dataflow(*SCENARIO.modules, config=SCENARIO.config).execute(
["interval_coded_members", "fitted_model"], inputs={"source_cohort": cohort_frame, "cohort_lineage": {}})
coded = run["interval_coded_members"]
carcinomas = set(cohort_frame.loc[cohort_frame["valor_codigo"] == "CARCINOMA", "pac_id"])
cases = set(coded.loc[(coded["c"] == 1) | np.isfinite(coded["r"]), "pac_id"])
assert cases == carcinomas
cin2 = training.dataflow(*SURVEILLANCE.modules, config=SURVEILLANCE.config).execute(
["fitted_model"], inputs={"source_cohort": cohort_frame, "cohort_lineage": {}})["fitted_model"]
h = len(SCENARIO.config["horizons_years"])
cancer, cin2plus = (m.predict_proba(cohort_frame)[:, 1:1 + h] for m in (run["fitted_model"], cin2))
scored = ~np.isnan(cancer) & ~np.isnan(cin2plus)
assert scored.any() and (cancer[scored] <= cin2plus[scored] + 1e-6).all()
+108 -6
View File
@@ -163,7 +163,7 @@ def test_the_graph_takes_exactly_its_config_and_the_cohort():
"incidence_features", "index_sample_days", "known_negative", "prevalent_window_months", "strata",
"train_fraction"}
# `index` from the config (a scenario without one keeps its cohort's index); the report's settings have defaults.
assert optional == {"index", "report_panels", "turnbull_bootstrap"}
assert optional == {"index", "prediction_index", "report_panels", "risk_interval_level", "turnbull_bootstrap"}
def test_the_dataflow_gives_metrics_at_every_horizon(cohort_frame):
@@ -181,9 +181,10 @@ def test_the_dataflow_gives_metrics_at_every_horizon(cohort_frame):
def test_training_and_estimating_score_every_member_at_every_horizon(cohort_file, mlflow_tracking, tmp_path,
predict_without_repository):
"""Pins down: through the generic driver the scenario registers a version whose estimate has one row per member
and horizon, a risk that doesn't fall with the horizon, the same outside this repository, and storable metadata.
Fails if the model or the estimate go back to one horizon, or the registered model needs this repository."""
"""Pins down: through the generic driver the scenario registers a version whose estimate has one row per
precolposcopy member (no biopsy) and horizon, dated at her latest complete cytology, a risk that doesn't fall
with the horizon, the same outside this repository, and storable metadata. Fails if the model or the estimate go
back to one horizon, a biopsied member is scored, or the registered model needs this repository."""
version = training.train(SCENARIO, CohortFile(cohort_file))
registry.client.set_registered_model_alias("cacu-cin2_pim", PRODUCTION_ALIAS, version)
output = tmp_path / "estimate.parquet"
@@ -191,7 +192,12 @@ def test_training_and_estimating_score_every_member_at_every_horizon(cohort_file
estimate(SCENARIO, CohortFile(cohort_file), output)
risks = pd.read_parquet(output)
assert len(risks) == 300 * len(CONFIG["horizons_years"])
frame = pd.read_parquet(cohort_file)
biopsied = set(frame.loc[frame["tipo"] == "biopsia", "pac_id"])
assert set(risks["pac_id"]) == set(frame["pac_id"]) - biopsied
assert len(risks) == (300 - len(biopsied)) * len(CONFIG["horizons_years"])
scored = risks.dropna(subset=["ic_bajo"])
assert len(scored) and ((scored["ic_bajo"] <= scored["probabilidad"]) & (scored["probabilidad"] <= scored["ic_alto"])).all()
by_member = risks.pivot(index="pac_id", columns="horizonte_anios", values="probabilidad")
assert (by_member.diff(axis=1).iloc[:, 1:] >= -1e-12).all().all()
assert pq.read_metadata(output).metadata[b"desenlace"] == b"cin2"
@@ -199,10 +205,76 @@ def test_training_and_estimating_score_every_member_at_every_horizon(cohort_file
uri = registry.resolve("cacu", "cin2_pim", version).model_uri
outside = predict_without_repository(uri, pd.read_parquet(cohort_file))
inside = mlflow.pyfunc.load_model(uri).predict(pd.read_parquet(cohort_file))
assert outside.shape == (300, len(CONFIG["horizons_years"]))
assert outside.shape == (300, 1 + 3 * len(CONFIG["horizons_years"]))
np.testing.assert_allclose(outside.to_numpy(), inside)
def test_the_prediction_index_is_the_latest_complete_cytology_before_any_colposcopy():
"""Pins down the surveillance model's prediction index: the latest cytology with both results; one missing its
HPV gives way to the one before; a patient with a colposcopy or a biopsy gets none (the post-colposcopy scenario
scores her). Fails if the index goes back to the cohort's first cytology or a referred patient is scored."""
def sample(pac_id, day, bethesda, vph):
key = f"S{pac_id}-{day}"
rows = [_row(pac_id, INDEX, day, "citologia", sample=key), _row(pac_id, INDEX, day + 7, "bethesda", bethesda, key)]
return rows + ([_row(pac_id, INDEX, day + 7, "vph", vph, key)] if vph else [])
rows = [*sample(1, 0, "ASC-US", "NEGATIVO"), *sample(1, 700, "LIEBG", "POSITIVO"),
*sample(2, 0, "NORMAL", "NEGATIVO"), *sample(2, 900, "LIEBG", None),
*sample(3, 0, "LIEBG", "POSITIVO"), _row(3, INDEX, 40, "colposcopia"), *sample(3, 400, "NORMAL", "NEGATIVO")]
frame = pd.DataFrame(rows, columns=COHORT_SCHEMA.names)
found = model.latest_index_results(frame, CONFIG["index_sample_days"], CONFIG["cytology"])
assert found["pac_id"].tolist() == [1, 2, 3]
assert found[model.INDEX_COLUMN].dt.date.tolist()[:2] == [INDEX + timedelta(days=700), INDEX]
assert found["cytology"].tolist()[:2] == ["LSIL", "NILM"] and found["hpv_positive"].tolist()[:2] == [1.0, 0.0]
assert pd.isna(found[model.INDEX_COLUMN].iloc[2]) and pd.isna(found["cytology"].iloc[2])
def test_the_registered_model_dates_each_risk_at_its_prediction_index(cohort_frame):
"""Pins down: with `prediction_index` the registered model gives the index date first (days since 1970) and the
risk of that visit's results, and no risk to a member without one. Fails if the date column is dropped, the
risk is computed from the cohort's index, or a member without an index gets a risk."""
found = training.dataflow(*SCENARIO.modules, config=CONFIG).execute(
["fitted_model", "fitted_mixture"], inputs={"source_cohort": cohort_frame, "cohort_lineage": {}})
output = found["fitted_model"].predict_proba(cohort_frame)
features = model.latest_index_results(cohort_frame, CONFIG["index_sample_days"], CONFIG["cytology"])
h = len(CONFIG["horizons_years"])
dated = ~np.isnan(output[:, 0])
assert dated.sum() == features[model.INDEX_COLUMN].notna().sum() and np.isnan(output[~dated, 1:]).all()
np.testing.assert_allclose(output[dated, 0], (features.loc[dated, model.INDEX_COLUMN] - model.EPOCH).dt.days)
expected = found["fitted_mixture"].predict_proba(features.loc[dated, model._features(CONFIG["history"])])
np.testing.assert_allclose(output[dated, 1:1 + h], expected)
def test_the_interval_brackets_the_same_risk(cohort_frame):
"""Pins down: with `interval_level` the mixture gives the risk unchanged and, after it, the interval's lower and
upper ends around it, NaN only where the risk is. Fails if the delta method moves the point, the blocks' order
changes, or an end crosses the risk."""
found = training.dataflow(*SCENARIO.modules, config=CONFIG).execute(
["fitted_mixture", "test_set", "fitted_model"], inputs={"source_cohort": cohort_frame, "cohort_lineage": {}})
X = found["test_set"][model._features(CONFIG["history"])]
h = len(CONFIG["horizons_years"])
point = found["fitted_mixture"].predict_proba(X)
banded = found["fitted_model"].named_steps["mixture"].predict_proba(X)
assert found["fitted_mixture"].interval_level is None and banded.shape == (len(X), 3 * h)
np.testing.assert_allclose(banded[:, :h], point)
low, high, known = banded[:, h:2 * h], banded[:, 2 * h:], ~np.isnan(point)
assert (np.isnan(low) == ~known).all() and (low[known] <= point[known]).all() and (point[known] <= high[known]).all()
assert (high[known] - low[known]).max() > 0
def test_the_scenario_says_what_its_number_is():
"""Pins down: `[estimand]` reaches the scenario with what the screens show next to each risk. Fails if the key is
renamed or `Scenario.from_toml` stops reading it."""
assert SCENARIO.estimand["quantity"] == "Probabilidad" and SCENARIO.estimand["horizons_unit"] == "años"
assert "KPNC" in SCENARIO.estimand["covariates"]
assert {"description", "outcome", "index_date"} <= set(SCENARIO.estimand) and "interval" not in SCENARIO.estimand
def test_each_stratum_gets_its_own_mixture_and_an_unseen_one_gets_no_risk(cohort_frame):
"""Pins down the stratification of the TOML: one fit per HPV value, each predicting only its own members, and NaN
(not another stratum's risk) for a value absent from training. Fails if the strata are pooled or mixed up."""
@@ -349,6 +421,36 @@ def _run_notebook(path, cohort_file, domain, scenario, monkeypatch, **parameters
return namespace
def test_the_subgroup_figure_draws_risks_in_percent():
"""Pins down: the report's curves are in percent, like the patient's risk and the table, with the axis saying so.
Fails if the figure goes back to proportions, which read as a risk a hundred times smaller."""
from models.cacu.cin2_pim import report
curve = {"years": [0.0, 5.0], "CR": [0.1, 0.2], "low": [0.05, 0.15], "high": [0.15, 0.25]}
record = {"combination": {"cytology": "LSIL", "hpv_positive": "positivo"}, "n": 10, "prevalent": 1,
"incident": 1, "empirical": curve, "model": curve, "e_o": []}
figure = report._figure([record], [0.0, 5.0])
assert [list(t.y) for t in figure.data if t.name in ("Turnbull", "Mezcla prevalencia-incidencia")] == [[10.0, 20.0]] * 2
assert figure.layout.yaxis.ticksuffix == " %" and "%" in figure.layout.yaxis.title.text
def test_each_subgroup_panel_has_its_own_scale():
"""Pins down: panels don't share the y axis, so each combination's curves fill their panel. Fails if the
subplots go back to one shared scale, where a 0.5 % curve is a flat line next to a 50 % one."""
from models.cacu.cin2_pim import report
def record(level, risk):
curve = {"years": [0.0, 5.0], "CR": [risk, risk], "low": [risk, risk], "high": [risk, risk]}
return {"combination": {"cytology": level, "hpv_positive": "positivo"}, "n": 10, "prevalent": 1,
"incident": 1, "empirical": curve, "model": curve, "e_o": []}
figure = report._figure([record("NILM", 0.005), record("HSIL+", 0.5)], [0.0, 5.0])
assert figure.layout.yaxis2.matches is None and figure.layout.yaxis2.anchor == "x2"
def test_the_subgroup_notebook_runs_on_a_builds_file(cohort_file, monkeypatch):
"""Pins down the PIM report's notebook (`models/cacu/cin2_pim/notebooks/reporte_subgrupos.ipynb`): its cells run on a
build's file with the platform's environment, compute the same combinations the dataflow does and draw them. Fails
@@ -0,0 +1,49 @@
"""What this module covers: `models.cacu.cin2_pim.likelihood` against KPNC's published risks (Cheung et al. 2020,
doi:10.1097/LGT.0000000000000528; tables of Egemen et al. 2020, doi:10.1097/LGT.0000000000000529).
`data/kpnc_reference.csv` holds the published cumulative risks at 0–5 years of the KPNC curves that one shared
I-spline baseline (order 4, 3 knots) with a proportional factor per curve reproduces to the rounding of the tables
(bayes-pim chapters 6 and 25): table 1 (screening, one baseline per current HPV), 17 (post-colposcopy), 18
(post-colposcopy, 2nd visit, the exact groups only), 24 and 25 (post-treatment). Each row is one curve with its group's
knots and γ and its own η; its CR(0) is the published one. Tables 4, 19 and 26, which no grouping reproduces, are left
out. Aggregates of public tables only.
"""
import json
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from scipy.special import logit
from models.cacu.cin2_pim import likelihood as L
REFERENCE = pd.read_csv(Path(__file__).parent / "data" / "kpnc_reference.csv", dtype={"table": str})
YEARS = range(6)
@pytest.mark.parametrize("key, group", list(REFERENCE.groupby(["table", "outcome", "group"])),
ids=lambda v: " ".join(v) if isinstance(v, tuple) else "")
def test_the_mixture_gives_kpncs_published_risks(key, group):
"""Pins down: with KPNC's knots, γ and η, `cumulative_risk` (logistic prevalence, PIMixture's I-splines,
proportional hazards) gives every published risk at 0–5 years to 1e-12. Fails if the I-spline basis, its
parameterization (exp γ), the proportional factor or the mixture CR = π + (1 − π)(1 − S) drift from PIMixture's."""
knots, gamma = json.loads(group["knots"].iloc[0]), np.array(json.loads(group["gamma"].iloc[0]))
n = len(group)
with np.errstate(divide="ignore"):
theta = logit(group["cr0"].to_numpy())
fitted = {"theta": theta, "beta": group["eta"].to_numpy(), "baseline": L.ISpline(tuple(knots), order=4),
"baseline_params": gamma}
found = L.cumulative_risk(fitted, np.eye(n), np.eye(n), YEARS)
published = group[[f"cr{t}" for t in YEARS]].to_numpy()
np.testing.assert_allclose(found, published, rtol=0, atol=1e-12)
def test_the_reference_covers_the_scenarios_tables():
"""Pins down: the fixture keeps the screening table and the post-colposcopy and post-treatment ones, both outcomes
each. Fails if a rebuild of the fixture drops a table the scenarios are checked against."""
assert {(t, o) for t, o in REFERENCE[["table", "outcome"]].itertuples(index=False)} == {
(t, o) for t in ("1", "17", "18", "24", "25") for o in ("CIN2+", "CIN3+")}
+25
View File
@@ -139,6 +139,21 @@ def test_training_registers_a_version_from_the_fitted_model_and_the_metrics(scen
assert training.find_trained(scenario, CohortFile(cohort_file)) == version
def test_training_stores_the_drawing_of_its_dataflow_as_files_of_the_version(scenario, cohort_file, mlflow_tracking):
"""Pins down: the version lists `diagramas/pipeline.dot` and, with Graphviz's `dot`, `diagramas/pipeline.svg`, one
file each (no archive), and the drawing names the scenario's nodes. Fails if training stops drawing its graph or
stores it as anything but separate files."""
pytest.importorskip("graphviz")
version = training.train(scenario, CohortFile(cohort_file))
files = {f["path"] for f in registry.artifacts("cacu", "fake_scenario", version)}
name, dot = registry.artifact("cacu", "fake_scenario", version, "diagramas/pipeline.dot")
assert name == "pipeline.dot" and b"fitted_model" in dot and b"metrics" in dot
assert "diagramas/pipeline.svg" in files or not training.pipeline_drawing(
training.dataflow(*scenario.modules, config=scenario.config))[1]
assert not any(path.endswith(".zip") for path in files)
def test_the_registered_model_runs_without_this_repository(scenario, cohort_file, mlflow_tracking,
predict_without_repository):
"""Pins down: the model's own package is pickled by value, so a Python that can't import `models`, Hamilton or the
@@ -196,3 +211,13 @@ def test_the_registered_model_needs_only_its_listed_requirements(scenario, cohor
assert f"scikit-learn=={installed('scikit-learn')}" in lines and f"numpy=={installed('numpy')}" in lines
assert not [line for line in lines if line.startswith("-e") or "/" in line]
def test_without_graphviz_training_has_no_drawing_and_still_registers():
"""Pins down: when Hamilton can't draw (no `graphviz` package, it gives None instead of raising), the drawing
is skipped rather than stopping the training. Fails if `pipeline_drawing` reads a missing graph."""
from types import SimpleNamespace
from models.dags.training import pipeline_drawing
assert pipeline_drawing(SimpleNamespace(display_all_functions=lambda *a, **k: None)) is None
+14 -1
View File
@@ -1,4 +1,4 @@
"""What this module covers: the registry's promotion checks, promotion and retirement, the lineage of a version, and
"""What this module covers: the registry's promotion checks, promotion and retirement, the scenarios in production, the lineage of a version, and
what its run stored (`registry.artifacts`, `registry.artifact`, `registry.routines`).
Fixtures: `production_ready` (from `conftest.py`), a PROD version whose run recorded every routine and its model;
@@ -108,6 +108,19 @@ def test_retire_and_lineage(production_ready):
registry.retire(domain, scenario, second)
def test_in_production_lists_the_scenarios_holding_the_alias(production_ready):
"""Only scenarios of the domain with a version in production are listed; a candidate or a retired one is not.
Fails if `in_production` stops reading the `produccion` alias or leaks another domain's models."""
domain, scenario, version = production_ready("v1")
production_ready("v1-dx", scenario="diagnostico")
assert registry.in_production(domain) == []
registry.promote(domain, scenario, version)
assert registry.in_production(domain) == [scenario]
assert registry.in_production("cama") == []
registry.retire(domain, scenario, version)
assert registry.in_production(domain) == []
@pytest.mark.parametrize("domain, scenario", [("cacu' OR '1'='1", None), ("cacu", "x' OR name LIKE '%")])
def test_version_filters_reject_anything_but_known_names(mlflow_tracking, domain, scenario):
with pytest.raises(ValueError):
+1 -1
View File
@@ -13,7 +13,7 @@ def test_the_cacu_templates_are_listed_with_the_scenarios_they_serve():
found = {t["id"]: t for t in notebook_templates("cacu")}
pim, survival = found["cacu/cin2_pim/reporte_subgrupos"], found["cacu/survival/reporte_subgrupos"]
assert pim["scenarios"] == ["cin2_pim", "cin2_pim_post_colposcopy", "cin2_pim_post_treatment"]
assert pim["scenarios"] == ["cancer_pim", "cin2_pim", "cin2_pim_post_colposcopy", "cin2_pim_post_treatment"]
assert survival["scenarios"] == ["survival"] and survival["domain"] == "cacu" and survival["title"]
+35
View File
@@ -0,0 +1,35 @@
"""An invented ADOS-2 association cohort: one row per child in the `tea` library's cohort columns, with two planted
effects (spikes in temporal_izq raise item 18, spindles in central lower the CSS) and everything else null."""
import numpy as np
import pandas as pd
from tea.associations.ados2 import _items as items
from tea.contracts import ZONES
ITEM_CODES = sorted({c for _, _, codes in items.ITEMS.values() for c in codes.values()})
def cohort(n: int = 60, seed: int = 4, with_items: bool = True) -> pd.DataFrame:
rng = np.random.default_rng(seed)
age = rng.uniform(16, 37, n).round(1)
module = np.where(age < 31, "TODDLER", np.where(rng.random(n) < .7, "MODULO_1", "MODULO_2"))
t = pd.DataFrame({"key": [f"e-{i:03d}" for i in range(n)], "age_months": age, "ados_module": module})
shared = rng.normal(0, 1, n)
for zone in ZONES:
t[f"z_spikes_{zone}"] = (.5 * shared + .85 * rng.normal(0, 1, n)).round(3)
t[f"z_spindles_{zone}"] = rng.normal(0, 1, n).round(3)
t["z_posterior_rhythm"] = rng.normal(0, 1, n).round(3)
t["z_gradient"] = rng.normal(0, 1, n).round(3)
for number, (_, _, codes) in items.ITEMS.items():
latent = rng.logistic(0, 1, n) + (1.6 * t["z_spikes_temporal_izq"].to_numpy() if number == 18 else 0)
level = np.digitize(latent, [-.3, 1.4, 3.2])
for m, code in codes.items():
if code not in t:
t[code] = np.nan
t.loc[t.ados_module == m, code] = level[t.ados_module.to_numpy() == m]
severity = rng.normal(0, 1, n) - .9 * t["z_spindles_central"].to_numpy()
t["css"] = np.clip(np.round(6 + 1.8 * severity), 1, 10).astype(int)
for code in ITEM_CODES:
if code not in t:
t[code] = np.nan
return t if with_items else t.drop(columns=ITEM_CODES)
+141
View File
@@ -0,0 +1,141 @@
"""What this module covers: the `tea` library's ADOS-2 association (`tea.associations.ados2`, modern, and
`tea.legacy.associations.ados2`, the research code vendored): the pairs it tests, the module-independent outcome
codes, recovery of planted effects, legacy and modern agreeing, the per-child scores and the saved state.
Fixtures: `cohort_items`, 60 invented children of 16 to 37 months (Toddler module under 31 months, Module 1 or 2
above) with item scores and a CSS, whose spike z in temporal_izq raises item 18 (intonation) and whose spindle z in
central lowers the CSS, everything else null; `cohort_css`, the same children without item scores; `fits`, both
implementations fitted once on each cohort.
"""
import numpy as np
import pandas as pd
import pytest
from ados2_cohort import ITEM_CODES, cohort
from tea.associations.ados2 import Ados2Association
from tea.associations.ados2 import _items as items
from tea.contracts import ASSOCIATION_COLUMNS, SCORE_COLUMNS, ZONES
from tea.legacy.associations.ados2 import LegacyAdos2Association
@pytest.fixture(scope="module")
def cohort_items():
"""60 children with item scores: spikes in temporal_izq raise item 18, spindles in central lower the CSS."""
return cohort()
@pytest.fixture(scope="module")
def cohort_css(cohort_items):
"""The same children with the CSS only, as when the psychologist reports no items."""
return cohort_items.drop(columns=[c for c in ITEM_CODES if c in cohort_items])
@pytest.fixture(scope="module")
def fits(cohort_items, cohort_css):
"""Modern and legacy, each fitted once on both cohorts, by (impl, level)."""
return {(impl, level): cls().fit(c) for impl, cls in (("modern", Ados2Association),
("legacy", LegacyAdos2Association))
for level, c in (("item", cohort_items), ("domain", cohort_css))}
def test_level_follows_the_cohort_and_codes_are_module_independent(fits):
"""Pins down: a cohort with items is fitted by item and one without by the CSS; item outcomes carry
`ados2_item_NN` and domain outcomes `CSS`, with events `>=1` and `>=8`; zones are the library's, `posterior`
or `global`. Fails if the level stops following the data, an outcome goes back to a per-module column code (one
code is another item in another module), or a zone code leaves the shared list."""
for impl in ("modern", "legacy"):
assert fits[impl, "item"].fitted["level"] == "item"
assert fits[impl, "domain"].fitted["level"] == "domain"
a = fits[impl, "item"].associations()
assert list(a.columns) == list(ASSOCIATION_COLUMNS)
assert set(a.outcome_code) <= {items.item_code(n) for n in items.ITEMS} | {"CSS"}
assert set(a.loc[a.kind == "item", "event"]) == {">=1"}
assert set(a.loc[a.kind == "domain", "event"]) == {">=8"}
assert set(a.zone) <= set(ZONES) | {"posterior", "global"}
assert set(fits[impl, "domain"].associations().outcome_code) == {"CSS"}
def test_the_planted_effects_are_found(fits):
"""Pins down: the item fit finds spikes in temporal_izq raising item 18 (odds ratio above 1, q < 0.05) and the CSS
fit finds spindles in central lowering the CSS (odds ratio below 1, q < 0.05). Fails if the Firth or ordinal fit,
the item read per module, or the q values break."""
a = fits["modern", "item"].associations().set_index(["biomarker", "zone", "outcome_code"])
item = a.loc[("spikes", "temporal_izq", "ados2_item_18")]
assert item.odds_ratio > 1 and item.q < .05
d = fits["modern", "domain"].associations().set_index(["biomarker", "zone", "outcome_code"])
css = d.loc[("spindles", "central", "CSS")]
assert css.odds_ratio < 1 and css.q < .05
@pytest.mark.parametrize("level", ["item", "domain"])
def test_legacy_and_modern_agree(fits, cohort_items, cohort_css, level):
"""Pins down: the modern port gives the vendored research code's odds ratios, intervals, p, q and per-child
probabilities exactly, at both levels. Fails if either side's design matrix, fit, interval search, FLIC
intercept or pair list drifts from the other."""
cohort = cohort_items if level == "item" else cohort_css
m, legacy = fits["modern", level], fits["legacy", level]
keys = ["biomarker", "zone", "outcome_code"]
joined = m.associations().merge(legacy.associations(), on=keys, suffixes=("_m", "_l"), validate="1:1")
assert len(joined) == len(m.associations()) == len(legacy.associations())
for c in ("odds_ratio", "ci_low", "ci_high", "p", "q", "sens_odds_ratio"):
np.testing.assert_allclose(joined[f"{c}_m"].astype(float), joined[f"{c}_l"].astype(float), rtol=1e-9)
scores = m.score(cohort).merge(legacy.score(cohort), on=["key", *keys], suffixes=("_m", "_l"), validate="1:1")
assert len(scores) == len(legacy.score(cohort)) > 0
np.testing.assert_allclose(scores.probability_m, scores.probability_l, atol=1e-9)
np.testing.assert_allclose(scores.reference_probability_m, scores.reference_probability_l, atol=1e-9)
def test_an_item_is_read_from_the_column_of_the_childs_module(cohort_items):
"""Pins down: item 11 (showing) is `sa_b12` in the Toddler module, `sa_b9` in Module 1 and `sa_b5` in Module 2,
and each child's score comes from its own module's column, with 3 as 2 and 7 as 0. Fails if items are read by
one column code for every module."""
t = pd.DataFrame({"ados_module": ["TODDLER", "MODULO_1", "MODULO_2", "MODULO_2"],
"sa_b12": [1, 2, 0, 0], "sa_b9": [0, 3, 0, 0], "sa_b5": [2, 0, 7, np.nan]})
assert items.item_scores(t, 11).tolist()[:3] == [1.0, 2.0, 0.0]
assert np.isnan(items.item_scores(t, 11).iloc[3])
def test_scores_cover_only_the_modules_with_the_item_and_survive_save_and_load(fits, cohort_items, tmp_path):
"""Pins down: a child is scored on an item only when its module has that item, every score row has a z and a
probability in [0, 1], and a saved and reloaded fit scores the same. Fails if scoring ignores the module, the
saved state misses what scoring needs, or the columns drift from `SCORE_COLUMNS`."""
m = fits["modern", "item"]
scores = m.score(cohort_items)
assert list(scores.columns) == list(SCORE_COLUMNS)
modules = cohort_items.set_index("key").ados_module
item_16 = scores[scores.outcome_code == "ados2_item_16"] # Module 2 only
assert set(modules[item_16.key]) <= {"MODULO_2"}
assert scores.probability.between(0, 1).all() and scores.z.notna().all()
m.save(tmp_path)
again = Ados2Association.load(tmp_path).score(cohort_items)
pd.testing.assert_frame_equal(scores, again)
def test_registered_under_the_association_groups():
"""Pins down: both implementations resolve through the entry points and pass the association protocol, and
the per-study pipeline does not load them. Fails if a registration is dropped or the association lands in the
pipeline's module groups."""
from tea.pipeline import registry
assert registry.association("ados2_association").impl == "modern"
assert registry.association("ados2_association", "legacy").impl == "legacy"
assert "ados2_association" not in registry.available("modern")
def test_a_module_the_fit_never_saw_is_not_scored_as_the_reference(fits, cohort_items):
"""Pins down: a child whose module was not in the pair's fit (here an unknown `MODULO_3`) gets no probability
instead of the reference module's. Fails if unseen levels fall back to all-zero indicators."""
m = fits["modern", "domain"]
other = cohort_items.head(3).assign(ados_module="MODULO_3", key=["x-1", "x-2", "x-3"])
assert m.score(other).empty
def test_a_singular_pair_or_an_infinite_z_does_not_stop_the_fit(cohort_css):
"""Pins down: a predictor equal to the module indicator (a rank-deficient design) leaves that pair with a reason
and no estimate while every other pair is fitted, and an infinite z is dropped rather than fitted. Fails if a
singular information matrix aborts the whole fit, or `inf` reaches the design."""
t = cohort_css.copy()
t["z_gradient"] = (t["ados_module"] == "TODDLER").astype(float)
t.loc[0, "z_posterior_rhythm"] = np.inf
a = Ados2Association().fit(t).associations().set_index(["biomarker", "zone"])
assert a["odds_ratio"].notna().sum() >= len(a) - 2
assert a.loc[("posterior_rhythm", "posterior"), "n"] == len(t) - 1
+140
View File
@@ -0,0 +1,140 @@
"""What this module covers: the ADOS-2 association against the TEA database (`models.ados2_relation`): the cohort
it builds from bronze (first valid EEG and first ADOS-2 per child), the rows it writes to `relacion_ados2` and
`relacion_ados2_paciente`, and versions (a new cohort is a later version, the same cohort writes nothing).
Fixtures: `tea_db` (an empty SQLite TEA database); `stored`, the invented cohort of `ados2_cohort` without item
scores (60 children, spindles in central lowering the CSS) written to bronze: each child with an ADOS-2 and a valid
analysed EEG `e-NNN` whose metric z and zone z are the cohort's, plus a later valid EEG `e-000-b` of child 1, an
invalid EEG of child 2 and a child 99 with an EEG and no ADOS-2.
"""
from datetime import date, datetime
import pytest
from ados2_cohort import ITEM_CODES, cohort
from sqlmodel import Session, select
from core.tea.models import Ados2, Eeg, EegMetrica, EegMetricaZona, Pacientes, RelacionAdos2, RelacionAdos2Paciente
from models import ados2_relation as rel
from tea.contracts import ZONES
CODES = {"spikes": "PICOS_PAROXISTICOS", "spindles": "HUSOS_SUENO_N2", "posterior_rhythm": "RITMO_POSTERIOR",
"gradient": "GRADIENTE_ANTEROPOSTERIOR"}
def _eeg(session, eeg_id, pac_id, row, *, studied=date(2025, 6, 1), valid=1):
session.add(Eeg(eeg_id=eeg_id, eeg_pac_id=pac_id, eeg_fecha_estudio=studied, eeg_valido=valid,
eeg_edad_meses=float(row.age_months)))
for biomarker, code in CODES.items():
met_id = f"{eeg_id}/{code}"
zoned = biomarker in rel.ZONED
session.add(EegMetrica(met_id=met_id, met_eeg_id=eeg_id, met_codigo=code,
met_z=None if zoned else float(row[f"z_{biomarker}"])))
if zoned:
session.add_all([EegMetricaZona(mez_id=f"{met_id}/{z}", mez_met_id=met_id, mez_zona=z,
mez_z=float(row[f"z_{biomarker}_{z}"])) for z in ZONES])
def _engine():
from persistance.db import get_tea_engine
return get_tea_engine()
@pytest.fixture
def stored(tea_db):
"""The CSS-only invented cohort in bronze, with the extra EEGs and child the module docstring lists."""
t = cohort().drop(columns=ITEM_CODES)
with Session(_engine()) as s:
for i, row in t.iterrows():
pac_id = i + 1
s.add(Pacientes(pac_id=pac_id, pac_id_hospital=f"H-{pac_id}"))
s.add(Ados2(ado_id=f"a-{pac_id}", ado_pac_id=pac_id, ado_fecha=date(2025, 5, 1),
ado_modulo=row.ados_module, ado_css=int(row.css)))
_eeg(s, row.key, pac_id, row)
_eeg(s, "e-000-b", 1, t.iloc[0], studied=date(2025, 9, 1))
_eeg(s, "e-001-x", 2, t.iloc[1], studied=date(2025, 3, 1), valid=0)
s.add(Pacientes(pac_id=99, pac_id_hospital="H-99"))
_eeg(s, "e-099", 99, t.iloc[2])
s.commit()
return t
def _read():
with Session(_engine()) as s:
return s.exec(select(RelacionAdos2)).all(), s.exec(select(RelacionAdos2Paciente)).all()
def test_a_fit_writes_one_version_of_estimated_rows_on_the_platform_codes(stored):
"""Pins down: one fit writes a `tea-<time>-<fingerprint>` version, unvalidated, over the 60 children with a
valid EEG and an ADOS-2, with the metric codes, `CSS` outcomes and an `>=8` event, and finds the planted
spindle effect in central. Fails if the cohort takes the child without ADOS-2 or the invalid EEG, the
biomarker codes stop following `model.toml`, or the written estimates stop being the library's."""
summary = rel.relate(at=datetime(2026, 11, 21, 12, 0, 0))
models, patients = _read()
assert summary.children == 60 and summary.level == "domain"
assert summary.version.startswith("tea-20261121T120000-") and len(summary.version) <= 32
assert {m.rel_version for m in models} == {summary.version} and len(models) == summary.associations
assert {m.rel_validado for m in models} == {0} and {m.rel_n_cohorte for m in models} == {60}
assert {m.rel_resultado for m in models} == {"CSS"} and {m.rel_evento for m in models} == {">=8"}
assert {m.rel_biomarcador for m in models} <= set(CODES.values())
central = next(m for m in models if m.rel_biomarcador == "HUSOS_SUENO_N2" and m.rel_zona == "central")
assert central.rel_or < 1 and central.rel_q < .05
assert len(patients) == summary.scored
def test_every_valid_eeg_of_the_cohort_is_scored_and_no_other(stored):
"""Pins down: child 1's later valid EEG gets probabilities too (the gold view shows the study's EEG, whichever
it is), while the invalid EEG and the EEG of the child without ADOS-2 get none. Fails if scoring stops at the
fit's EEGs or starts scoring outside the cohort."""
rel.relate()
_, patients = _read()
eegs = {p.rap_eeg_id for p in patients}
assert {"e-000", "e-000-b"} <= eegs
assert not {"e-001-x", "e-099"} & eegs
assert all(0 <= p.rap_probabilidad <= 1 and 0 <= p.rap_probabilidad_referencia <= 1 for p in patients)
def test_the_same_cohort_writes_nothing_and_a_new_one_is_a_later_version(stored):
"""Pins down: fitting the same cohort again writes nothing and names the latest version; a changed z is a new
version that sorts after the first, so the gold view's greatest version is the newest fit. Fails if reruns
duplicate versions, or the version stops sorting by time."""
first = rel.relate(at=datetime(2026, 11, 21, 12, 0, 0))
again = rel.relate(at=datetime(2026, 11, 22, 12, 0, 0))
assert again.unchanged and again.version == first.version
assert len({m.rel_version for m in _read()[0]}) == 1
with Session(_engine()) as s:
zone = s.get(EegMetricaZona, "e-000/HUSOS_SUENO_N2/central")
zone.mez_z = 3.0
s.add(zone)
s.commit()
later = rel.relate(at=datetime(2026, 11, 23, 12, 0, 0))
assert not later.unchanged and later.version > first.version
assert {m.rel_version for m in _read()[0]} == {first.version, later.version}
def test_an_open_interval_is_stored_as_null():
"""Pins down: an infinite interval limit (the profile never crossed the threshold) is stored as NULL, which every
engine accepts. Fails if `inf` reaches the database (MySQL and SQL Server reject it)."""
assert rel._finite(float("inf")) is None and rel._finite(None) is None and rel._finite(2.5) == 2.5
def test_the_fit_uses_the_first_eeg_with_predictors_and_a_new_eeg_is_a_new_version(stored):
"""Pins down: a child whose earliest valid EEG has no metric rows is fitted on its next EEG, and a valid EEG
added for a child already in the fit (so the fit table is the same) is still a new version that scores it.
Fails if the fit takes an EEG without predictors (the child would drop out of every model), or the fingerprint
covers only the fit table (the new EEG would stay unscored)."""
with Session(_engine()) as s:
s.add(Eeg(eeg_id="e-000-a", eeg_pac_id=1, eeg_fecha_estudio=date(2025, 1, 1), eeg_valido=1,
eeg_edad_meses=20.0))
s.commit()
first = rel.relate(at=datetime(2026, 11, 21, 12, 0, 0))
assert first.children == 60
assert "e-000-a" not in {p.rap_eeg_id for p in _read()[1]}
with Session(_engine()) as s:
_eeg(s, "e-000-c", 1, stored.iloc[0], studied=date(2025, 12, 1))
s.commit()
later = rel.relate(at=datetime(2026, 11, 22, 12, 0, 0))
assert not later.unchanged and later.version > first.version
models, patients = _read()
latest = {m.rel_id for m in models if m.rel_version == later.version}
assert "e-000-c" in {p.rap_eeg_id for p in patients if p.rap_rel_id in latest}
+104
View File
@@ -0,0 +1,104 @@
"""What this module covers: the ADOS-2 totals, CSS and classification of `tea.scoring`, and the job that writes
them to the TEA database (`models.ados2_scoring`).
Fixtures: `tea_db` (an empty SQLite TEA database); `stored`, a child born 2022-01-01 with three Module 3 evaluations
(items summing to 12, no CSS), one Module 1 evaluation (some words, items summing to 6) and one evaluation that
already carries a CSS of 9 and a classification from its source.
"""
from datetime import date
import pytest
from sqlmodel import Session, select
from core.tea.models import Ados2, Pacientes
from models import ados2_scoring
from tea.scoring import score
ITEMS_12 = {"sa_b1": 2, "sa_b2": 2, "sa_b3": 2, "sa_b4": 2, "rrb_d1": 2, "rrb_d2": 2}
def test_a_score_of_three_counts_as_two():
"""Pins down: item scores above 2 are capped at 2, as the algorithms do. Fails if the cap is dropped (the
total would be 8, not 4)."""
s = score("MODULO_3", {"sa_b1": 3, "sa_b2": 3, "rrb_d1": 3, "rrb_d2": 3})
assert (s.social_affect, s.restricted_repetitive, s.total) == (4, 4, 8)
def test_the_css_rises_with_the_total_and_the_classification_follows_it():
"""Pins down: for one module a higher total never gives a lower CSS, and the classification is no-spectrum
under CSS 3, spectrum from 3 and autism from 5. Fails if a cut-point row stops being ordered or the
classification thresholds move."""
codes = [f"sa_b{i}" for i in range(1, 13)] + ["rrb_d1", "rrb_d2", "rrb_d4", "rrb_d5"]
scores = [score("MODULO_3", {c: 2 if i < n else 0 for i, c in enumerate(codes)}) for n in range(0, 17)]
css = [s.css for s in scores]
assert css == sorted(css) and css[0] == 1 and css[-1] == 10
assert [scores[0].classification, scores[3].classification, scores[8].classification] == [
"NO_ESPECTRO", "ESPECTRO_AUTISTA", "AUTISMO"]
@pytest.mark.parametrize("module, age, algorithm, expected", [
("MODULO_1", None, "Algunas palabras", None),
("MODULO_1", 40.0, None, None),
("MODULO_2", None, None, None),
("MODULO_3", None, None, 7),
])
def test_a_table_that_needs_age_or_language_level_gives_no_css_without_them(module, age, algorithm, expected):
"""Pins down: Modules 1 and 2 give no CSS without the child's age (and Module 1 without its algorithm), Module 3
needs neither. Fails if a missing age silently picks a table."""
assert score(module, ITEMS_12, age_months=age, algorithm=algorithm).css == expected
def test_the_toddler_module_gives_a_range_of_concern_and_no_css():
"""Pins down: Toddler totals become a classification by age band and never a CSS: a total of 12 is mild to
moderate at 25 months and at 19, 9 is none at 19 but mild to moderate at 25. Fails if Toddler starts
returning a CSS or the two age bands share cut points."""
t12 = {**{f"sa_b{i}": 2 for i in (1, 4, 5, 6)}, "rrb_d1": 2, "rrb_d2": 2}
t9 = {**{f"sa_b{i}": 2 for i in (1, 4, 5)}, "rrb_d1": 2, "rrb_d2": 1}
assert [score("TODDLER", t12, age_months=m).classification for m in (19, 25)] == ["PREOCUPACION_LEVE_MODERADA"] * 2
assert [score("TODDLER", t9, age_months=m).classification for m in (19, 25)] == [
"NO_ESPECTRO", "PREOCUPACION_LEVE_MODERADA"]
assert score("TODDLER", t12, age_months=25).css is None
def test_an_unknown_module_or_missing_domain_is_not_scored():
"""Pins down: no score without a known module or without items in both domains. Fails if a half-read PDF is
scored from one domain."""
assert score(None, ITEMS_12) is None
assert score("MODULO_9", ITEMS_12) is None
assert score("MODULO_3", {"sa_b1": 2}) is None
@pytest.fixture
def stored(tea_db):
"""Child 1 (born 2022-01-01) with the evaluations the module docstring lists."""
from persistance.db import get_tea_engine
with Session(get_tea_engine()) as s:
s.add(Pacientes(pac_id=1, pac_id_hospital="H-1", pac_fecha_nacimiento=date(2022, 1, 1)))
for i in (1, 2, 3):
s.add(Ados2(ado_id=f"a-{i}", ado_pac_id=1, ado_fecha=date(2026, 1, 1), ado_modulo="MODULO_3",
**{f"ado_{k}": v for k, v in ITEMS_12.items()}))
s.add(Ados2(ado_id="m1", ado_pac_id=1, ado_fecha=date(2025, 1, 1), ado_modulo="MODULO_1",
ado_algoritmo="Algunas palabras", ado_sa_a2=2, ado_sa_b1=2, ado_sa_b3=1, ado_rrb_d1=1))
s.add(Ados2(ado_id="given", ado_pac_id=1, ado_fecha=date(2026, 1, 1), ado_modulo="MODULO_3", ado_css=9,
ado_clasificacion="AUTISMO", **{f"ado_{k}": v for k, v in ITEMS_12.items()}))
s.commit()
yield s
def test_the_job_fills_what_is_empty_and_keeps_what_a_source_gave(stored):
"""Pins down: `score_all` writes CSS and classification on evaluations that lack them, uses the age at the
evaluation (3 years for the Module 1 one, so the under-five table) and leaves a stored CSS alone. Fails if it
overwrites a source's value by default or reads the wrong age."""
summary = ados2_scoring.score_all(stored)
assert (summary.evaluations, summary.scored) == (5, 4)
rows = {r.ado_id: r for r in stored.exec(select(Ados2)).all()}
assert rows["a-1"].ado_css == 7 and rows["a-1"].ado_clasificacion == "AUTISMO"
assert rows["m1"].ado_css == 3 and rows["m1"].ado_clasificacion == "ESPECTRO_AUTISTA"
assert rows["given"].ado_css == 9
def test_overwrite_recomputes_what_a_source_gave(stored):
"""Pins down: with `overwrite` the stored CSS is recomputed from the items. Fails if `overwrite` is ignored."""
ados2_scoring.score_all(stored, overwrite=True)
assert stored.get(Ados2, "given").ado_css == 7
+32
View File
@@ -0,0 +1,32 @@
"""Outside markers for centile and age-block references in modern and legacy tea.
Fixtures: parameterized baseline modules and in-memory synthetic control values.
"""
import numpy as np
import pytest
from tea.biomarkers.spindles import _baseline as modern
from tea.legacy.biomarkers.spindles import _baseline as legacy
@pytest.mark.parametrize("baseline", (modern, legacy))
def test_centile_outside_requires_a_reference(baseline):
"""Pin float -1/0/+1 and missing values. Fails if missing data, uncovered ages or sparse controls give zero."""
curve = baseline.CentileCurves().fit(np.tile([1, 2, 3], 50), np.repeat([12, 24, 36], 50))
outside, _ = curve.deviation([0, 2, 4, np.nan, 2, 2], [24, 24, 24, 24, 60, np.nan])
assert outside.dtype.kind == "f"
np.testing.assert_array_equal(outside, [-1, 0, 1, np.nan, np.nan, np.nan])
sparse = baseline.CentileCurves().fit([1, 2], [12, 36])
assert np.isnan(sparse.deviation([2], [24])[0][0])
@pytest.mark.parametrize("baseline", (modern, legacy))
def test_age_block_outside_requires_a_z_score(baseline):
"""Pin float markers with a valid score. Fails if a missing score or degenerate MAD is classified in range."""
fitted = baseline.AgeBlockZ().fit(np.arange(30), np.full(30, 24))
outside, _ = fitted.deviation([-2, 15, 40, np.nan, 15], [24, 24, 24, 24, np.nan])
assert outside.dtype.kind == "f"
np.testing.assert_array_equal(outside, [-1, 0, 1, np.nan, np.nan])
flat = baseline.AgeBlockZ().fit(np.ones(30), np.full(30, 24))
assert np.isnan(flat.deviation([1], [24])[0][0])
+28 -1
View File
@@ -144,7 +144,34 @@ def test_an_analysis_replaces_the_previous_one_with_the_same_ids(bronze, curves)
(1, "tea-eeg-posterior-rhythm/3")
assert metrics["HUSOS_SUENO_N2"].met_z is None and metrics["HUSOS_SUENO_N2"].met_modelo is None
electrodes = sorted((e.mel_met_id, e.mel_electrodo, e.mel_valor) for e in _all(EegMetricaElectrodo))
assert electrodes == sorted((metrics[code].met_id, "Fz", 1.5) for code in ("HUSOS_SUENO_N2", "HUSOS_SUENO_N3"))
mapped = [m.code for m in settings().metrics if m.electrodes]
assert electrodes == sorted((metrics[code].met_id, "Fz", 1.5) for code in mapped)
@pytest.mark.parametrize("case", ("uncovered_age", "missing_cutoffs"))
def test_missing_reference_stores_null_outside(bronze, curves, case):
"""Pin SQL NULL when a reference interval is absent. Fails if a missing marker is cast to int or stored as zero."""
from persistance.tea import eeg_repository
age = 60.0
if case == "missing_cutoffs":
from tea.biomarkers.posterior_rhythm._baseline import AgeBlockZ
age = 26.0
reference = AgeBlockZ().fit([5.0, 6.0, 7.0], [age] * 3)
reference.state["cortes"] = [float("nan")] * 2
curves.module("eeg-posterior-rhythm").baseline = reference
measurement = fake_measure("e-1", b"edf", age, settings())
with eeg_repository.open_session() as session:
save(session, "e-1", rows(measurement, settings(), curves))
session.commit()
metric = next(row for row in _all(EegMetrica) if row.met_codigo == "RITMO_POSTERIOR")
assert metric.met_valor == 9.0
assert metric.met_modelo == "tea-eeg-posterior-rhythm/3"
assert metric.met_fuera is None
if case == "missing_cutoffs":
assert metric.met_z == pytest.approx(3.0 / 1.4826)
def test_the_batch_analyses_each_pending_eeg_once_and_logs_it(bronze, governance_db, curves):
+166
View File
@@ -0,0 +1,166 @@
"""What this module covers: the zone values of the EEG analysis (`models.tea.eeg.settings` zones,
`analyze._metrics`, `models.eeg_analysis.rows` and `save`): which metrics read zones, how a biomarker's
`<zone_prefix><zone>` features become a metric's zones, and the `eeg_metrica_zona` rows with the z of the zone's
baseline, replaced on the next analysis.
Fixtures: `tea_db` (an empty SQLite TEA database); `spike_zones`, `Baselines` whose only production version is
`tea-eeg-spikes/2`, a spikes module with one centile curve, 0.5/1/2 spikes per minute at p5/median/p95 at every age,
for `spike_zone_rate_nrem_temporal_izq` alone.
"""
from datetime import date
from types import SimpleNamespace
import pandas as pd
import pytest
from sqlmodel import select
from core.tea.models import Eeg, EegMetrica, EegMetricaZona, Pacientes
from models.eeg_analysis import rows, save
from models.tea.eeg.analyze import Measurement, MetricValue, _metrics
from models.tea.eeg.baselines import Baselines
from models.tea.eeg.settings import settings
from tea.contracts import ZONES
@pytest.fixture
def spike_zones():
"""Spikes in production with a curve for the temporal_izq zone feature only."""
from tea.biomarkers.spikes._baseline import CentileCurves
curve = pd.DataFrame({"edad_meses": [12.0, 36.0], "n_efectivo": [50.0] * 2, "p5": [0.5] * 2, "p25": [0.8] * 2,
"mediana": [1.0] * 2, "p75": [1.4] * 2, "p95": [2.0] * 2})
module = SimpleNamespace(baselines={"spike_zone_rate_nrem_temporal_izq": CentileCurves(curva=curve)})
class Registry:
def resolve(self, domain, scenario):
if scenario != "eeg-spikes":
raise LookupError(scenario)
return SimpleNamespace(version="2", model_uri="models:/tea-eeg-spikes/2")
return Baselines("tea", registry=Registry(), loader=lambda uri: module)
def test_spikes_and_spindles_read_zones_and_their_scenarios_are_trained():
"""Pins down: the spike metric reads `spike_zone_rate_nrem_<zone>` and the per-electrode `spike_density_nrem_<E>`
from spikes with `spike_minutes_nrem` as exposure, both spindle metrics read `spindle_zone_<zone>` from spindles
at their stage, and no scenario is added for them (the zone features train with the metric's own biomarker).
Fails if `model.toml` loses the zones the ADOS-2 association reads, or zones start a scenario of their own."""
s = settings()
by_code = {m.code: m for m in s.metrics}
spikes = by_code["PICOS_PAROXISTICOS"]
assert (spikes.zones, spikes.zone_prefix, spikes.electrodes, spikes.electrode_prefix) == (
"spikes", "spike_zone_rate_nrem_", "spikes", "spike_density_nrem_")
assert spikes.exposure == "spike_minutes_nrem"
assert spikes.zone_scenario == spikes.scenario == "eeg-spikes"
for code in ("HUSOS_SUENO_N2", "HUSOS_SUENO_N3"):
assert (by_code[code].zones, by_code[code].zone_prefix) == ("spindles", "spindle_zone_")
assert set(s.scenarios) == {"eeg-posterior-rhythm", "eeg-spindles-n2", "eeg-spindles-n3",
"eeg-spindle-topography-n2", "eeg-spindle-topography-n3", "eeg-spikes",
"eeg-gradient"}
def test_a_biomarkers_zone_features_become_the_metrics_zones():
"""Pins down: the features named `<zone_prefix><zone>` are the metric's zones by zone code, the electrode map
keeps its own prefix, and a feature whose name only starts like the prefix's biomarker is left out. Fails if
the prefix is not stripped or zone and electrode features mix."""
s = settings()
spikes = {"spike_rate_nrem": 0.7, "spike_density_nrem_T3": 1.2,
**{f"spike_zone_rate_nrem_{z}": float(i) for i, z in enumerate(ZONES)},
"spike_zone_rate_awake_central": 9.0, "spike_minutes_nrem": 12.5}
measured = {("posterior_rhythm", None): {}, ("spindles", "N2"): {}, ("spindles", "N3"): {},
("spindle_topography", "N2"): {}, ("spindle_topography", "N3"): {}, ("spikes", None): spikes,
("gradient", None): {}}
value = {v.code: v for v in _metrics(measured, s)}["PICOS_PAROXISTICOS"]
assert value.value == 0.7
assert value.electrodes == {"T3": 1.2}
assert value.zones == {z: float(i) for i, z in enumerate(ZONES)}
assert value.exposure == 12.5
def test_zone_rows_carry_the_zone_baselines_z_and_are_replaced(tea_db, spike_zones):
"""Pins down: each zone of a metric is an `eeg_metrica_zona` row of that metric, with the z of the zone's own
curve where one is in production and null elsewhere, and a new analysis replaces them. Fails if zone rows are
not written, read another feature's baseline, or pile up across analyses."""
from persistance.tea import eeg_repository
s = settings()
with eeg_repository.open_session() as session:
session.add_all([Pacientes(pac_id=1), Eeg(eeg_id="e-1", eeg_pac_id=1, eeg_fecha_estudio=date(2026, 3, 1))])
session.commit()
zones = {"temporal_izq": 2.0, "central": 1.0}
m = Measurement(key="e-1", age_months=24.0, plan_hash="h", versions="v", valid=1,
metrics=tuple(MetricValue(x.code, 1.0, {}, zones if x.code == "PICOS_PAROXISTICOS" else {})
for x in s.metrics))
for _ in range(2):
with eeg_repository.open_session() as session:
save(session, "e-1", rows(m, s, spike_zones))
session.commit()
with eeg_repository.open_session() as session:
found = {z.mez_zona: z for z in session.exec(select(EegMetricaZona)).all()}
met_id = session.exec(select(EegMetrica.met_id).where(EegMetrica.met_codigo == "PICOS_PAROXISTICOS")).one()
assert set(found) == {"temporal_izq", "central"}
assert {z.mez_met_id for z in found.values()} == {met_id}
assert found["temporal_izq"].mez_z == pytest.approx(1.645) and found["temporal_izq"].mez_valor == 2.0
assert found["central"].mez_z is None
def test_a_count_baseline_gets_the_metrics_minutes(tea_db):
"""Pins down: a baseline whose `deviation` takes `exposure` gets the metric's minutes for the value, every
electrode and every zone, and one without that parameter is called as before. Fails if the minutes stop reaching
count baselines (spike z would be computed against no exposure) or curves start receiving them."""
import numpy as np
seen = []
class Count:
def deviation(self, values, ages_months, exposure=None):
seen.append(float(exposure[0]))
return np.array([0.0]), np.array([1.0])
module = SimpleNamespace(baselines={"spike_rate_nrem": Count(), "spike_density_nrem_T3": Count(),
"spike_zone_rate_nrem_central": Count()})
class Registry:
def resolve(self, domain, scenario):
if scenario != "eeg-spikes":
raise LookupError(scenario)
return SimpleNamespace(version="4", model_uri="models:/tea-eeg-spikes/4")
s = settings()
m = Measurement(key="e-1", age_months=24.0, plan_hash="h", versions="v", valid=1,
metrics=tuple(MetricValue(x.code, 1.0, {"T3": 0.5}, {"central": 0.2}, 12.5)
if x.code == "PICOS_PAROXISTICOS" else MetricValue(x.code, 1.0)
for x in s.metrics))
out = rows(m, s, Baselines("tea", registry=Registry(), loader=lambda uri: module))
assert seen == [12.5, 12.5, 12.5]
assert [z.mez_z for z in out.zones] == [1.0] and [e.mel_z for e in out.electrodes] == [1.0]
def test_a_count_baselines_range_is_its_own_for_the_minutes(tea_db):
"""Pins down: a baseline with `percentiles` gives the metric's p5, median and p95 from the metric's minutes, and
the metric row stores them, so a spike metric with a z has a reference range. Fails if count baselines lose their
range (the patient summary then refuses the EEG: a metric with a z and no reference)."""
import numpy as np
class Count:
def deviation(self, values, ages_months, exposure=None):
return np.array([0.0]), np.array([0.5])
def percentiles(self, ages_months, exposure):
return np.array([[0.0, 0.1, 0.4]]) * 10 / exposure[0]
module = SimpleNamespace(baselines={"spike_rate_nrem": Count()})
class Registry:
def resolve(self, domain, scenario):
if scenario != "eeg-spikes":
raise LookupError(scenario)
return SimpleNamespace(version="4", model_uri="models:/tea-eeg-spikes/4")
s = settings()
m = Measurement(key="e-1", age_months=24.0, plan_hash="h", versions="v", valid=1,
metrics=tuple(MetricValue(x.code, 1.0, {}, {}, 20.0) if x.code == "PICOS_PAROXISTICOS"
else MetricValue(x.code, 1.0) for x in s.metrics))
out = rows(m, s, Baselines("tea", registry=Registry(), loader=lambda uri: module))
spikes = next(r for r in out.metrics if r.met_codigo == "PICOS_PAROXISTICOS")
assert (spikes.met_p5, spikes.met_mediana, spikes.met_p95) == (0.0, 0.05, 0.2)
+99
View File
@@ -0,0 +1,99 @@
"""What this module covers: the spikes biomarker's baselines around the per-electrode and
per-zone features: training from a feature table that predates them, and loading a baseline
saved before they existed. Both implementations, modern and legacy.
Fixtures: `old_table`, a DataFrame with only the original seven study-wide spikes features and
an age column, as a reference cohort measured before the density features existed; `full_table`,
the same rows plus every current feature.
"""
import importlib
import json
import numpy as np
import pandas as pd
import pytest
ORIGINAL = ("spike_rate_awake", "spike_rate_nrem", "spike_nrem_activation", "spike_focus_frac",
"spike_laterality", "spike_frac_generalized", "spike_index_nrem")
MODULES = (("tea.biomarkers.spikes.api", "Spikes"),
("tea.legacy.biomarkers.spikes.api", "LegacySpikes"))
@pytest.fixture(scope="module")
def old_table():
"""Twelve synthetic children with only the study-wide spikes features and their ages."""
rng = np.random.default_rng(0)
t = pd.DataFrame({f: rng.uniform(0.0, 2.0, size=12) for f in ORIGINAL})
t["age_months"] = np.linspace(16.0, 36.0, 12)
return t
@pytest.fixture(scope="module")
def full_table(old_table):
"""`old_table` plus every per-electrode, per-zone and inherited feature the module has now."""
rng = np.random.default_rng(1)
t = old_table.copy()
cls = getattr(importlib.import_module(MODULES[0][0]), MODULES[0][1])
for f in cls.features:
if f not in t.columns:
t[f] = rng.uniform(0.0, 2.0, size=len(t))
return t
@pytest.mark.parametrize("path,name", MODULES)
def test_training_skips_features_the_table_lacks(path, name, old_table, tmp_path):
"""Pins down: training from a table without the new columns works, fits only the columns
it has, and saving then loading that baseline keeps predicting those features only.
Fails if `train` starts requiring the new columns, or if save/load stops round-tripping
a baseline that knows nothing about them.
"""
cls = getattr(importlib.import_module(path), name)
module = cls().train(old_table)
out = module.predict(old_table)
assert set(out.feature) == set(ORIGINAL)
module.save(tmp_path)
loaded = cls.load(tmp_path)
assert set(loaded.predict(old_table).feature) == set(ORIGINAL)
assert len(cls.features) > len(ORIGINAL)
@pytest.mark.parametrize("path,name", MODULES)
def test_a_baseline_saved_before_the_new_features_loads_and_predicts(path, name, old_table,
full_table, tmp_path):
"""Pins down: a baseline bundle written before the new features existed (no new
parameters in params.json, none of the new features in baseline.json) loads into the
current module and predicts; the new features simply have no baseline and are not
evaluated.
Fails if load starts requiring the new parameters, if a saved baseline stops being
readable after the feature list grows, or if predict evaluates a feature that has no
fitted baseline.
"""
cls = getattr(importlib.import_module(path), name)
cls().train(old_table).save(tmp_path)
params = json.loads((tmp_path / "params.json").read_text())
for k in ("vent_s", "rechazar_transitorio", "herencia_s"):
params.pop(k, None)
(tmp_path / "params.json").write_text(json.dumps(params))
loaded = cls.load(tmp_path)
out = loaded.predict(full_table)
assert set(out.feature) == set(ORIGINAL)
assert len(out) == len(full_table) * len(ORIGINAL)
@pytest.mark.parametrize("path,name", MODULES)
def test_a_full_baseline_round_trips(path, name, full_table, tmp_path):
"""Pins down: with every column present, train fits all features and save/load predicts
the same deviations.
Fails if the per-electrode and per-zone features stop getting their own baselines when
the training table has them.
"""
cls = getattr(importlib.import_module(path), name)
module = cls().train(full_table)
before = module.predict(full_table)
assert set(before.feature) == set(cls.features)
module.save(tmp_path)
after = cls.load(tmp_path).predict(full_table)
pd.testing.assert_frame_equal(before, after)
+142
View File
@@ -0,0 +1,142 @@
"""What this module covers: the count reference of spike candidates (`_baseline.CountRate` of both spikes modules)
and how `Spikes` / `LegacySpikes` use it: the aggregate rate and its dispersion, a child's z from the tail of its
own count in its own minutes, NaN without exposure, the per-electrode zone scale, and which features it serves.
Fixtures: `count_rate`, parametrized over the modern and legacy `CountRate` classes; `reference`, 200 invented
children of 16 to 36 months with 5 to 15 clean NREM minutes and Poisson candidates at 0.02 per minute (most have
none), as rates.
"""
import numpy as np
import pandas as pd
import pytest
from scipy import stats
from tea.biomarkers.spikes import _baseline as modern_baseline
from tea.biomarkers.spikes import api as modern
from tea.legacy.biomarkers.spikes import _baseline as legacy_baseline
from tea.legacy.biomarkers.spikes import api as legacy
@pytest.fixture(params=["modern", "legacy"])
def count_rate(request):
"""The implementation's `CountRate` class."""
return {"modern": modern_baseline, "legacy": legacy_baseline}[request.param].CountRate
@pytest.fixture
def reference():
"""(rates, ages, minutes) of 200 children with Poisson candidates at 0.02 per minute."""
rng = np.random.default_rng(3)
minutes = rng.uniform(5, 15, 200).round(2)
counts = rng.poisson(0.02 * minutes)
return counts / minutes, rng.uniform(16, 36, 200), minutes
def test_the_reference_is_the_aggregate_rate_with_its_dispersion(count_rate):
"""Pins down: the rate is all candidates over all minutes of the children within the ages (one child of 50
months left out) and the dispersion is the research code's moments estimate, Poisson (inf) without excess.
Fails if the rate becomes a mean of per-child rates, the age range stops filtering, or the moments change."""
rates = np.array([0, 0.1, 0.2, 0])
b = count_rate().fit(rates, np.array([20, 20, 30, 50.0]), exposure=np.array([10, 10, 20, 30.0]))
assert b.state["rate"] == pytest.approx(5 / 40) and b.state["reference"] == 3 and b.state["events"] == 5
n, mu = np.array([0, 1, 4]), 5 / 40 * np.array([10, 10, 20])
excess = ((n - mu) ** 2 - n).sum()
assert b.state["k"] == (pytest.approx((mu ** 2).sum() / excess) if excess > 0 else np.inf)
flat = count_rate().fit(np.array([0.1, 0.1]), np.array([20, 20.0]), exposure=np.array([10, 10.0]))
assert flat.state["k"] == np.inf
def test_a_count_is_judged_in_its_own_minutes(count_rate, reference):
"""Pins down: no candidates is a mildly negative z (never -inf), the same one candidate is rarer in fewer
minutes, many candidates in few minutes are outside +1 with a large z, and z is the normal quantile of the mid-p
tail. Fails if z stops using the child's minutes, the mid-p correction, or the 0.05 cut for `outside`."""
b = count_rate().fit(*reference[:2], exposure=reference[2])
outside, z = b.deviation(np.array([0.0, 1 / 5, 1 / 40, 8 / 5]), np.full(4, 24.0),
exposure=np.array([10.0, 5.0, 40.0, 5.0]))
assert -1 < z[0] < 0
assert z[1] > z[2]
assert outside.tolist() == [0.0, 0.0, 0.0, 1.0] and z[3] > 3
mu = b.state["rate"] * 5.0
tail = stats.poisson.sf(0, mu) if np.isinf(b.state["k"]) else stats.nbinom.sf(0, b.state["k"],
b.state["k"] / (b.state["k"] + mu))
at = (stats.poisson.pmf(1, mu) if np.isinf(b.state["k"])
else stats.nbinom.pmf(1, b.state["k"], b.state["k"] / (b.state["k"] + mu)))
assert z[1] == pytest.approx(stats.norm.ppf(1 - (tail - at / 2)))
def test_no_exposure_value_age_or_reference_is_nan(count_rate, reference):
"""Pins down: without minutes, with zero minutes, without a value, at an age outside the range, or against a
reference with no minutes, z and outside are NaN, and a reference with no candidates at all clips z instead of
reaching infinity. Fails if any of them reads as within the reference, or `inf` leaves the baseline."""
b = count_rate().fit(*reference[:2], exposure=reference[2])
outside, z = b.deviation(np.array([0.1, 0.1, np.nan, 0.1]), np.array([24, 24, 24, 60.0]),
exposure=np.array([np.nan, 0.0, 10.0, 10.0]))
assert np.isnan(z).all() and np.isnan(outside).all()
assert np.isnan(b.deviation(np.array([0.1]), np.array([24.0]))[1]).all()
empty = count_rate().fit(np.array([0.1]), np.array([24.0]), exposure=np.array([np.nan]))
assert np.isnan(empty.deviation(np.array([0.1]), np.array([24.0]), exposure=np.array([10.0]))[1]).all()
none = count_rate().fit(np.zeros(5), np.full(5, 24.0), exposure=np.full(5, 10.0))
assert none.deviation(np.array([0.5]), np.array([24.0]), exposure=np.array([10.0]))[1][0] == count_rate.Z_MAX
def test_the_reference_range_is_the_rates_expected_in_the_childs_minutes(count_rate, reference):
"""Pins down: the p5, median and p95 of a count reference are the reference count's quantiles in the child's own
minutes (times the zone scale) as rates, ordered, narrower in rate with more minutes, and NaN where z is NaN.
Fails if the range stops using the child's minutes or the scale, or a child without minutes gets one (the
patient summary shows it as the metric's reference)."""
b = count_rate(scale=2.0).fit(*reference[:2], exposure=reference[2])
out = b.percentiles(np.array([24.0, 24.0, 24.0, 60.0]), np.array([5.0, 400.0, np.nan, 10.0]))
mu, k = b.state["rate"] * 400.0 * 2.0, b.state["k"]
p95 = stats.poisson.ppf(0.95, mu) if np.isinf(k) else stats.nbinom.ppf(0.95, k, k / (k + mu))
assert out[1, 2] == pytest.approx(p95 / 800.0)
assert (np.diff(out[:2], axis=1) >= 0).all()
assert out[1, 2] - out[1, 0] < out[0, 2] - out[0, 0] or out[0, 2] == 0
assert np.isnan(out[2:]).all()
def test_round_trip_and_scale(count_rate, reference):
"""Pins down: `to_dict` / `from_dict` keep the state and the scale, and a per-electrode zone value is counted
back through its electrodes (0.1 per minute per electrode over 3 electrodes in 10 minutes is 3 candidates).
Fails if the scale is lost on save or not applied."""
b = count_rate(scale=3.0).fit(*reference[:2], exposure=reference[2])
again = count_rate.from_dict(b.to_dict())
args = (np.array([0.1]), np.array([24.0]))
assert again.deviation(*args, exposure=np.array([10.0]))[1] == pytest.approx(
b.deviation(*args, exposure=np.array([10.0]))[1])
assert again.scale == 3.0
counts, exposure = b._counts(np.array([0.1]), np.array([10.0]))
assert counts.tolist() == [3.0] and exposure.tolist() == [30.0]
@pytest.mark.parametrize("module", [modern, legacy], ids=["modern", "legacy"])
def test_the_rates_are_counted_against_their_minutes(module, reference):
"""Pins down: every rate and density feature (overall, per electrode, per zone, unnormalised zone, inherited)
has a count baseline whose exposure is the minutes of its own state and variant, the minutes themselves have no
baseline, and the other spike features keep the configured one; a table without the minutes gives NaN for the
counted features. Fails if a rate falls back to centile curves (collapsed at 0 in the reference) or reads
another state's minutes."""
spikes = (module.Spikes if module is modern else module.LegacySpikes)()
assert set(module.EXPOSURE) == {f for f in module.FEATURES if f.startswith(
("spike_rate_", "spike_density_", "spike_zone_", "spike_inherited_rate_", "spike_inherited_zone_"))}
assert all(module.EXPOSURE[f].endswith(("_nrem" if "nrem" in f else "_awake")) for f in module.EXPOSURE)
assert not set(module.MINUTES) & set(module.FEATURES)
assert {spikes.baselines[f].name for f in module.EXPOSURE} == {"count_rate"}
assert spikes.baselines["spike_laterality"].name == "curves"
rates, ages, minutes = reference
table = pd.DataFrame({"spike_rate_nrem": rates, "spike_minutes_nrem": minutes, "age_months": ages})
spikes.train(table)
out = spikes.predict(table.iloc[:3]).set_index("feature")
assert out.loc["spike_rate_nrem", "z"].notna().all()
blind = spikes.predict(table.iloc[:3].drop(columns="spike_minutes_nrem")).set_index("feature")
assert blind.loc["spike_rate_nrem", "z"].isna().all()
def test_legacy_and_modern_count_alike(reference):
"""Pins down: both implementations' count baselines give the same reference and the same z. Fails if one copy
of `CountRate` drifts from the other."""
rates, ages, minutes = reference
a = modern_baseline.CountRate().fit(rates, ages, exposure=minutes)
b = legacy_baseline.CountRate().fit(rates, ages, exposure=minutes)
assert a.state == b.state
np.testing.assert_array_equal(a.deviation(rates, ages, exposure=minutes)[1],
b.deviation(rates, ages, exposure=minutes)[1])
+424
View File
@@ -0,0 +1,424 @@
"""What this module covers: the spikes biomarker's density features: only useful candidates
count (a field and no vertex/POSTS/ocular mark), the per-electrode and per-zone density per
state, the 0-vs-NaN convention, and the inherited-state variant where a stretch without a
clean-window state takes the nearest labeled window's state (30 s, conservative on
transitions, never before the stable start). Both implementations, modern and legacy, are
exercised and must agree.
Fixtures: synthetic in-memory studies built around 1/f noise with spike waveforms injected
(`density_study`: 40 field spikes at C3 in sleep and 20 isolated artifacts on O2 in wake;
`rejected_study`: all sleep, a 20 s stretch the QC left without a state, and 20 s annotated
as crying; `edge_study`: a single clean sleep window at 10-14 s with one field spike at 13 s;
`montage_study`: sleep windows at 2-6 s and 30-34 s with field spikes at 10 s, 24 s and 31 s)
and a quiet all-wake study. Nothing comes from a patient.
"""
import contextlib
import importlib
import io
import numpy as np
import pandas as pd
import pytest
FS = 250.0
DUR = 600.0
SCALP = "Fp1 Fp2 F7 F3 Fz F4 F8 T3 C3 Cz C4 T4 T5 P3 Pz P4 T6 O1 O2".split()
C3_NEIGHBORS = ("F3", "T3", "Cz", "P3")
DENSITY_MODULES = ("tea.biomarkers.spikes._density", "tea.legacy.biomarkers.spikes._density")
def _fondo(n, n_ch, rng):
"""1/f noise at ~20 µV per channel, as the director's spike-detector validation uses."""
f = np.fft.rfftfreq(n, 1 / FS)
f[0] = f[1]
out = np.empty((n, n_ch))
for j in range(n_ch):
esp = (1.0 / f) * np.exp(1j * rng.uniform(0, 2 * np.pi, len(f)))
y = np.fft.irfft(esp, n)
out[:, j] = y / np.std(y) * 20.0
return out
def _punta(dur_ms=50.0, amp=120.0, post=60.0):
"""A spike with its slow posterior wave, as the director's criterion 3 describes."""
n = int(dur_ms * FS / 1000)
t = np.linspace(-1, 1, max(n, 3))
p = amp * (1 - t ** 2) ** 2
m = int(0.30 * FS)
s = -post * np.sin(np.pi * np.linspace(0, 1, m))
return np.concatenate([p, s])
def _add_spikes(x, rng, canal, spans, field):
"""`spikes` per (start_s, end_s) span on `canal`, with the field on its 10-20 neighbors
when `field`, as one simultaneous discharge."""
idx = {c: i for i, c in enumerate(SCALP)}
pun = _punta()
for a, b, k in spans:
for t in np.sort(rng.uniform(a, b, k)):
i = int(t * FS)
x[i:i + len(pun), idx[canal]] += pun
if field:
for v in C3_NEIGHBORS:
x[i:i + len(pun), idx[v]] += 0.6 * pun
return x
def _study(x, labels, annotations=()):
"""The contracts' Study around an in-memory (samples, channels) µV array: one variant,
4 s windows at a 2 s step labeled by sleep_state, and the annotated states as
annotation_mask events (the same annotations ride the variant for the legacy adapter,
whose director code translates them itself)."""
import mne
from tea.contracts import Labels, Preprocessed, Study
from tea.processes.annotation_mask.api import state_of
n = x.shape[0]
raw = mne.io.RawArray(x.T * 1e-6, mne.create_info(SCALP[: x.shape[1]], FS, ch_types="eeg"),
verbose="error")
anns = [(float(t0), float(d), e) for t0, d, e in annotations]
if anns:
onsets, durs, descs = zip(*anns)
raw.set_annotations(mne.Annotations(list(onsets), list(durs), list(descs)))
starts = np.arange(0.0, n / FS - 4.0 + 1e-9, 2.0)
windows = pd.DataFrame({"start_s": starts, "end_s": starts + 4.0, "clean": True, "gap": False})
prep = Preprocessed(variants={"hp05_prom": raw}, windows=windows, age_months=24.0,
plan={"name": "synthetic"}, plan_hash="synthetic")
sleep_state = Labels("sleep_state",
per_window=pd.Series(labels, index=windows.index, name="vigilancia"))
events = pd.DataFrame([{"onset_s": t0, "duration_s": d, "estado": state_of(e)}
for t0, d, e in anns if state_of(e)],
columns=["onset_s", "duration_s", "estado"])
annotation_mask = Labels("annotation_mask", events=events)
return Study(prep, {"sleep_state": sleep_state, "annotation_mask": annotation_mask})
def _labels_for(edits):
"""A 600 s window at 2 s step labeled 'sueno' everywhere, with `edits` {start_s: label}."""
starts = np.arange(0.0, DUR - 4.0 + 1e-9, 2.0)
labels = np.full(len(starts), "sueno", dtype=object)
for t0, e in edits.items():
labels[starts == float(t0)] = e
return list(labels)
@pytest.fixture(scope="module")
def density_study():
"""Half sleep, half wake: 40 spikes with field at C3 in the sleep half, 20 isolated
artifacts on O2 in the wake half (no field: they must not count as useful)."""
rng = np.random.default_rng(5)
x = _fondo(int(DUR * FS), len(SCALP), rng)
x = _add_spikes(x, rng, "C3", [(200.0, 290.0, 40)], field=True)
solo = _punta(dur_ms=50.0, amp=150.0, post=0.0)
idx = {c: i for i, c in enumerate(SCALP)}
for t in np.sort(rng.uniform(310.0, 590.0, 20)):
i = int(t * FS)
x[i:i + len(solo), idx["O2"]] += 1.4 * solo
starts = np.arange(0.0, DUR - 4.0 + 1e-9, 2.0)
labels = np.where(starts < 300.0, "sueno", "vigilia")
return _study(x, labels)
@pytest.fixture(scope="module")
def rejected_study():
"""All sleep: 6 spikes in a 20 s stretch the QC left without a state (150-170 s), 6 in
clean sleep, 6 in a stretch annotated as crying (400-420 s)."""
rng = np.random.default_rng(8)
x = _fondo(int(DUR * FS), len(SCALP), rng)
x = _add_spikes(x, rng, "C3", [(152.0, 168.0, 6), (200.0, 216.0, 6), (402.0, 418.0, 6)],
field=True)
labels = _labels_for({t0: "sin_estado" for t0 in range(148, 170, 2)})
return _study(x, labels, annotations=((400.0, 20.0, "Llanto"),))
@pytest.fixture(scope="module")
def wake_study():
"""Two quiet minutes of wake: no spike, no sleep."""
rng = np.random.default_rng(2)
labels = ["vigilia"] * len(np.arange(0.0, 120.0 - 4.0 + 1e-9, 2.0))
return _study(_fondo(int(120 * FS), len(SCALP), rng), labels)
@pytest.fixture(scope="module")
def edge_study():
"""One minute with a single clean sleep window at 10-14 s and one field spike at 13 s:
inside the 4 s window the state was classified on, beyond the 2 s grid step."""
rng = np.random.default_rng(11)
x = _fondo(int(60 * FS), len(SCALP), rng)
x = _add_spikes(x, rng, "C3", [(12.9, 13.1, 1)], field=True)
starts = np.arange(0.0, 60.0 - 4.0 + 1e-9, 2.0)
labels = np.full(len(starts), "sin_estado", dtype=object)
labels[starts == 10.0] = "sueno"
return _study(x, list(labels))
@pytest.fixture(scope="module")
def montage_study():
"""One minute with clean sleep windows at 2-6 s and 30-34 s and field spikes at 10 s
(unlabeled gap before the stable start), 24 s (unlabeled gap after it) and 31 s
(inside the second window)."""
rng = np.random.default_rng(13)
x = _fondo(int(60 * FS), len(SCALP), rng)
x = _add_spikes(x, rng, "C3", [(9.9, 10.1, 1), (23.9, 24.1, 1), (30.9, 31.1, 1)],
field=True)
starts = np.arange(0.0, 60.0 - 4.0 + 1e-9, 2.0)
labels = np.full(len(starts), "sin_estado", dtype=object)
labels[starts == 2.0] = "sueno"
labels[starts == 30.0] = "sueno"
return _study(x, list(labels))
def _measure(impl, study, **kwargs):
path = "tea.legacy.biomarkers.spikes.api" if impl == "legacy" else "tea.biomarkers.spikes.api"
cls = getattr(importlib.import_module(path), "LegacySpikes" if impl == "legacy" else "Spikes")
return cls(**kwargs).measure(study)
@pytest.fixture(scope="module")
def measured_density(density_study):
"""The density study measured by both implementations, {'modern': {...}, 'legacy': {...}}."""
return {impl: _measure(impl, density_study) for impl in ("modern", "legacy")}
@pytest.fixture(scope="module")
def measured_rejected(rejected_study):
"""The rejected-stretch study measured by both implementations."""
return {impl: _measure(impl, rejected_study) for impl in ("modern", "legacy")}
def test_useful_candidates_map_to_c3_and_the_central_zone(measured_density):
"""Pins down: with field spikes at C3 in sleep, the NREM density lands on C3 and the
central zone (per electrode, so it divides by the zone's 3 electrodes), every other
electrode is exactly 0, and the isolated wake artifacts on O2 count nowhere.
Fails if candidates without a field start counting, if canal_max stops being the
electrode a discharge is attributed to, or if the zone density stops being normalised
per electrode.
"""
m = measured_density["modern"]
assert m["spike_rate_nrem"] > 0
# the density divides by the unrounded minutes (the por_canal convention) and the
# rate by the two-decimal minutes (the indicadores convention), so they can differ
# by that rounding
assert m["spike_density_nrem_C3"] == pytest.approx(m["spike_rate_nrem"], rel=0.01)
assert m["spike_density_nrem_C3"] > 10 * max(m["spike_rate_awake"], 0.01)
for e in SCALP:
esperado = m["spike_rate_nrem"] if e == "C3" else 0.0
assert m[f"spike_density_nrem_{e}"] == pytest.approx(esperado, rel=0.01), e
assert m["spike_zone_nrem_central"] == pytest.approx(m["spike_rate_nrem"] / 3, rel=0.01)
assert m["spike_zone_nrem_frontal_izq"] == 0.0
assert m["spike_zone_nrem_occipital"] == 0.0
assert m["spike_density_awake_O2"] == 0.0
def test_a_quiet_present_electrode_is_zero_and_a_state_without_minutes_is_nan(wake_study):
"""Pins down: an electrode present with no candidates reads 0, never NaN, while a state
with no clean minutes (no sleep in an all-wake study) makes every feature of that state
NaN, inherited ones included.
Fails if the densities stop distinguishing 'no candidates' (0) from 'no denominator'
(NaN), or if the inherited variant stops honouring the same convention.
"""
m = _measure("modern", wake_study)
for e in SCALP:
assert m[f"spike_density_nrem_{e}"] != m[f"spike_density_nrem_{e}"] # NaN
assert m[f"spike_density_awake_{e}"] == 0.0
for z in ("central", "occipital", "temporal_der"):
assert m[f"spike_zone_nrem_{z}"] != m[f"spike_zone_nrem_{z}"]
assert m[f"spike_zone_awake_{z}"] == 0.0
assert m[f"spike_inherited_zone_nrem_{z}"] != m[f"spike_inherited_zone_nrem_{z}"]
assert m["spike_inherited_rate_nrem"] != m["spike_inherited_rate_nrem"]
assert m["spike_inherited_rate_awake"] == pytest.approx(0.0)
@pytest.mark.parametrize("module", DENSITY_MODULES)
def test_absent_electrode_and_zone_are_nan(module):
"""Pins down: an electrode missing from the montage has a NaN density (it cannot be
measured), and a zone with no present electrode is NaN too.
Fails if absent electrodes start reading as a measured 0.
"""
mod = importlib.import_module(module)
ev = pd.DataFrame({"canal_max": ["C3", "C3"], "fase": ["sueno", "sueno"],
"vertice": [False, False], "posts": [False, False],
"ocular": [False, False], "vecinos": [2, 2]})
out = mod.electrode_densities(ev, {"sueno": 2.0}, electrodes=("C3", "T6"), present=("C3",))
assert out["spike_density_nrem_C3"] == pytest.approx(1.0)
assert out["spike_density_nrem_T6"] != out["spike_density_nrem_T6"]
zonas = mod.zone_densities(ev, {"sueno": 2.0}, present=("C3",))
assert zonas["spike_zone_nrem_central"] == pytest.approx(1.0)
assert zonas["spike_zone_nrem_temporal_der"] != zonas["spike_zone_nrem_temporal_der"]
@pytest.mark.parametrize("module", DENSITY_MODULES)
def test_states_inherit_from_the_nearest_labeled_window(module):
"""Pins down (port of the research repo's inheritance test): a stretch the QC left
unlabeled takes the nearest clean window's state up to 30 s away; farther, or before
the first labeled window (or `t_min`), it stays without a state; intervals never
overlap.
Fails if the 30 s reach, the nearest-window rule or the `t_min` floor stop being
applied.
"""
mod = importlib.import_module(module)
t0 = np.r_[np.arange(20, 40, 2.0), np.arange(60, 98, 2.0), np.arange(200, 240, 2.0)]
labeled = pd.DataFrame({"t_ini_s": t0, "t_fin_s": t0 + 2.0, "etiqueta": "sueno"})
v = mod.inherit_states(labeled, 300.0, inherit_s=30.0, t_min=15.0)
def etq(t):
m = (v.t_ini_s <= t) & (t < v.t_fin_s)
return (v.etiqueta[m].iloc[0], bool(v.heredado[m].iloc[0])) if m.any() else (None, None)
assert etq(30) == ("sueno", False) # clean window
assert etq(50) == ("sueno", True) # 20 s gap between clean windows
assert etq(120) == ("sueno", True) # 20 s after the last clean window
assert etq(150) == (None, None) # more than 30 s away from both
assert etq(18) == (None, None) # before the first clean window (t_min 15)
assert not (v.t_ini_s.to_numpy()[1:] < v.t_fin_s.to_numpy()[:-1]).any()
@pytest.mark.parametrize("module", DENSITY_MODULES)
def test_inheritance_is_conservative_across_state_transitions(module):
"""Pins down (port of the research repo's conservative-transition test): an unlabeled
stretch between two different states stays 'transicion' and counts in neither; between
two windows of the same state it inherits that state.
Fails if the transition rule starts assigning one of the two states.
"""
mod = importlib.import_module(module)
t0 = np.r_[np.arange(0, 40, 2.0), np.arange(60, 100, 2.0), np.arange(110, 150, 2.0)]
e = np.r_[["somnolencia"] * 20, ["sueno"] * 20, ["sueno"] * 20]
labeled = pd.DataFrame({"t_ini_s": t0, "t_fin_s": t0 + 2.0, "etiqueta": e})
v = mod.inherit_states(labeled, 160.0)
def etq(t):
m = (v.t_ini_s <= t) & (t < v.t_fin_s)
return v.etiqueta[m].iloc[0] if m.any() else None
assert etq(45) == "transicion" and etq(58) == "transicion"
assert etq(105) == "sueno"
assert etq(30) == "somnolencia" and etq(70) == "sueno"
@pytest.mark.parametrize("module", DENSITY_MODULES)
def test_candidate_category_marks_isolated_and_marked(module):
"""Pins down: a candidate is 'util' only with a field and no mark; the director's mark
order (posts, vertice, ocular) wins over 'aislado'.
Fails if the category rule starts counting marked or fieldless candidates as useful.
"""
mod = importlib.import_module(module)
ev = pd.DataFrame({"vecinos": [2, 0, 3, 1, 0],
"posts": [False, False, True, False, False],
"vertice": [False, False, False, True, False],
"ocular": [False, False, False, False, True]})
assert list(mod.candidate_category(ev)) == ["util", "aislado", "posts", "vertice", "ocular"]
def test_rejected_stretch_counts_only_when_inherited(measured_rejected):
"""Pins down (port of the research repo's rejected-window test): spikes in a stretch
the QC left without a state count in NREM only through inheritance — the direct rate
sees only the clean-stretch spikes — and spikes in a stretch annotated as crying count
nowhere, because the detector's own gate rejects those windows.
Fails if the inherited variant starts using the direct states, or if annotated states
stop gating the detector.
"""
for m in measured_rejected.values():
assert 0 < m["spike_rate_nrem"] < m["spike_inherited_rate_nrem"]
assert m["spike_inherited_rate_nrem"] == pytest.approx(2 * m["spike_rate_nrem"], rel=0.2)
assert m["spike_inherited_zone_nrem_central"] > m["spike_zone_nrem_central"]
assert m["spike_inherited_rate_awake"] != m["spike_inherited_rate_awake"] # no wake
def test_without_inheritance_the_inherited_variant_matches_the_direct(rejected_study):
"""Pins down: with the inheritance reach at 0 the inherited variant reduces to the
direct one (same candidates, same minutes).
Fails if the inherited run stops deriving its states from the inheritance intervals.
"""
m = _measure("modern", rejected_study, herencia_s=0.0)
assert m["spike_inherited_rate_nrem"] == pytest.approx(m["spike_rate_nrem"], rel=1e-9)
assert m["spike_inherited_zone_nrem_central"] == pytest.approx(m["spike_zone_nrem_central"],
rel=1e-9)
@pytest.mark.parametrize("impl", ("modern", "legacy"))
def test_candidate_inside_the_classified_window_counts_as_direct(impl, edge_study):
"""Pins down (the reviewer's 13 s scenario): a candidate at 13 s with a single clean
4 s sleep window starting at 10 s lies inside the window's own state, so the direct
NREM rate counts it (1 spike over the 4 clean gate minutes of [10, 14)); the inherited
run labels 13 s as direct too and only stretches [14, 44) inherit.
Fails if `_vig` shortens the state windows to the 2 s grid step again: the spike would
fall outside every window, the direct rate would read 0 and only the inherited run
would count it.
"""
m = _measure(impl, edge_study)
assert m["spike_rate_nrem"] == pytest.approx(14.286, abs=0.001) # 1 / 0.07 rounded minutes
assert m["spike_density_nrem_C3"] == pytest.approx(15.0, abs=0.01) # 1 over 4/60 unrounded
assert m["spike_inherited_rate_nrem"] == pytest.approx(1.754, abs=0.001)
@pytest.mark.parametrize("impl", ("modern", "legacy"))
def test_no_inherited_state_before_the_stable_start(impl, montage_study):
"""Pins down (the reviewer's stable-start scenario): with the stable start at 20 s,
the spike at 10 s — in the gap after an early labeled window but before the stable
start — gets no state anywhere, while the spike at 24 s inherits and the spike at
31 s is direct. The direct run sees only 31 s (0.13 clean sleep minutes, rate 7.692);
the inherited run counts 24 s and 31 s but not 10 s (0.73 minutes, rate 2.74). With
the default stable start of 0 the 10 s spike inherits as well (0.97 minutes, 3.093).
Fails if `measure` stops passing the stable start to the inheritance (the 10 s spike
would count in the inherited rate) or if the early window's reach is clamped wrongly.
"""
m = _measure(impl, montage_study, stable_start_s=20.0)
assert m["spike_rate_nrem"] == pytest.approx(7.692, abs=0.001)
assert m["spike_inherited_rate_nrem"] == pytest.approx(2.74, abs=0.001)
sin_montaje = _measure(impl, montage_study)
assert sin_montaje["spike_inherited_rate_nrem"] == pytest.approx(3.093, abs=0.001)
@pytest.mark.parametrize("impl", ("modern", "legacy"))
def test_crying_annotation_rejects_gate_windows(impl, rejected_study):
"""Pins down (port of the research repo's annotated-window test): the detector's 2 s
gate rejects the windows of the crying stretch and nothing else.
Fails if annotated states stop reaching the quality gate (the crying spikes would then
count as sleep).
"""
if impl == "modern":
from tea.biomarkers.spikes import _density
from tea.biomarkers.spikes.api import Spikes
module = Spikes()
est, canales = module._prepare(rejected_study)
gate = _density.gate_windows(est, canales, module.vent_s, module.rechazar_transitorio)
else:
from tea.legacy.biomarkers.spikes import _adapter, _density
from tea.legacy.biomarkers.spikes._director import eeg_io
module = _density
with _adapter.estudio(rejected_study.prep, "hp05_prom", eeg_io) as est, \
contextlib.redirect_stdout(io.StringIO()):
gate = _density.gate_windows(est, eeg_io, 2.0, False)
lloro = gate.motivo.str.contains("estado llanto", regex=False)
assert lloro.sum() >= 8 and not gate[lloro].apta.any()
assert gate[~lloro].apta.all()
def test_legacy_and_modern_agree_on_every_feature(measured_density, measured_rejected):
"""Pins down: both implementations expose the same 79 features with the same values on
the same study, old and new alike.
Fails if one implementation's port of the detector, the densities or the inheritance
drifts from the other's.
"""
for nombre, medido in (("density", measured_density), ("rejected", measured_rejected)):
moderno, legado = medido["modern"], medido["legacy"]
assert set(moderno) == set(legado)
for f, v in moderno.items():
otro = legado[f]
iguales = v == otro or (np.isnan(v) and np.isnan(otro))
assert iguales or v == pytest.approx(otro, rel=1e-6, abs=1e-12), (nombre, f, v, otro)
+154
View File
@@ -0,0 +1,154 @@
"""Spindle detection and summaries, plus loading partial spindle baselines.
Fixtures: `sleep_recording` supplies synthetic EEG with short, long or sustained
sigma bursts. `tmp_path` holds a saved spindle baseline.
"""
from types import SimpleNamespace
import numpy as np
import pandas as pd
import pytest
from tea.biomarkers.spindles.api import Spindles
from tea.legacy.biomarkers.spindles.api import LegacySpindles
from tea.legacy.processes.spindle_detection.api import LegacySpindleDetection
from tea.processes.spindle_detection.api import SpindleDetection
CHANNELS = "Fp1 Fp2 F7 F3 Fz F4 F8 T3 C3 Cz C4 T4 T5 P3 Pz P4 T6 O1 O2".split()
FS = 250
DENSITY = "spindle_density_per_min_channel"
NO_LONG = "spindle_density_per_min_channel_no_long"
@pytest.fixture
def sleep_recording():
"""Make 600 s of sleep on the 10-20 montage with selectable sigma bursts."""
def make(mode):
rng = np.random.default_rng(1)
duration = 600
freq = np.fft.rfftfreq(duration * FS, 1 / FS)
freq[0] = freq[1]
voltages = np.empty((duration * FS, len(CHANNELS)))
for i in range(len(CHANNELS)):
spectrum = np.exp(1j * rng.uniform(0, 2 * np.pi, len(freq))) / freq
background = np.fft.irfft(spectrum)
voltages[:, i] = background * (20 / background.std())
def inject(start, length, hz, amplitude, gains):
t = np.arange(int(length * FS)) / FS
envelope = np.hanning(len(t)) if length < 2 else np.clip(np.minimum(t, length - t) / 0.5, 0, 1)
wave = amplitude * envelope * np.sin(2 * np.pi * hz * t)
for channel, gain in gains.items():
a = int(start * FS)
voltages[a:a + len(t), CHANNELS.index(channel)] += gain * wave
short = dict.fromkeys(("F3", "F4", "C3", "C4", "Cz"), 1.0) | {"Fz": 0.8, "P3": 0.7, "P4": 0.7}
starts = np.arange(5, duration - 10, 9.0)
if mode != "empty":
for start in starts + rng.uniform(-1, 1, len(starts)):
if mode == "long" and (200 < start < 240 or 400 < start < 410):
continue
inject(start, 1, 12.5, 50, short)
if mode == "long":
inject(205, 25, 13, 60, {"C3": 1, "C4": 1, "Cz": 1, "F3": 0.8, "F4": 0.8})
inject(402, 5, 12, 60, {"Fz": 1, "F3": 0.6, "F4": 0.6})
if mode == "continuous":
inject(0, duration * 0.6, 13, 60, short)
if mode == "empty":
voltages.fill(0)
class Raw:
n_times = len(voltages)
ch_names = CHANNELS
info = {"sfreq": FS}
annotations = ()
def get_channel_types(self):
return ["eeg"] * len(self.ch_names)
def get_data(self, picks):
return voltages[:, [self.ch_names.index(name) for name in picks]].T / 1e6
windows = pd.DataFrame({"start_s": np.arange(0, duration, 4.0)})
return SimpleNamespace(variant=lambda _: Raw(), windows=windows)
return make
IMPLEMENTATIONS = ((SpindleDetection, Spindles), (LegacySpindleDetection, LegacySpindles))
def measure(prep, implementation, phase="N2"):
detector, biomarker = implementation
labels = {"sleep_state": SimpleNamespace(per_window=["sueno"] * len(prep.windows)),
"slow_wave_staging": SimpleNamespace(per_window=["N2"] * len(prep.windows))}
study = SimpleNamespace(prep=prep, label=labels.__getitem__)
labels["spindle_detection"] = detector(phase=phase).predict(study)
return biomarker().measure(study), labels["spindle_detection"].events
def test_long_runs_split_events_and_density(sleep_recording):
"""Pin long/extreme counts and the existing density. Fails if split events disappear from the old density."""
prep = sleep_recording("long")
outputs = []
for implementation in IMPLEMENTATIONS:
result, events = measure(prep, implementation)
assert ((events.channel == "C3") & events.onset_s.between(204, 231)).sum() >= 6
assert result["spindle_n_long_runs"] == 6
assert result["spindle_n_extreme"] == 5
assert 24 <= result["spindle_max_run_s"] <= 27
assert result[DENSITY] == round(len(events) / 10 / 13, 3)
assert result[NO_LONG] < result[DENSITY]
outputs.append(result)
for feature in ("spindle_n_long_runs", "spindle_n_extreme", "spindle_max_run_s",
"spindle_sigma_occupancy_median", "spindle_sigma_occupancy_max", NO_LONG):
assert outputs[0][feature] == pytest.approx(outputs[1][feature], abs=0.01)
@pytest.mark.parametrize("implementation", IMPLEMENTATIONS)
def test_short_bursts_and_sustained_sigma(sleep_recording, implementation):
"""Pin zero long runs with short spindles and occupancy with sustained sigma. Fails if occupancy uses event thresholds."""
short, _ = measure(sleep_recording("short"), implementation)
sustained, _ = measure(sleep_recording("continuous"), implementation)
assert short["spindle_n_long_runs"] == short["spindle_n_extreme"] == 0
assert short[NO_LONG] == short[DENSITY]
assert short["spindle_sigma_occupancy_max"] < 0.45
assert sustained["spindle_sigma_occupancy_max"] >= 0.55
@pytest.mark.parametrize("implementation", IMPLEMENTATIONS)
def test_spindle_density_by_electrode_and_zone(sleep_recording, implementation):
"""Pin event counts per sleep minute and per searched electrode, NaN on a channel the detector never searches
(O1, and so the occipital zone). Fails if empty searched channels are omitted, an unsearched channel reports a
density, or a phase leaks."""
prep = sleep_recording("short")
result, events = measure(prep, implementation)
counts = events.channel.value_counts()
assert counts["C3"] > 0 and counts["Fz"] > 0
assert result["spindle_electrode_C3"] == counts["C3"] / 10
assert np.isnan(result["spindle_electrode_O1"])
assert np.isnan(result["spindle_zone_occipital"])
assert result["spindle_zone_central"] == counts[["C3", "Cz", "C4"]].sum() / 30
other_phase, _ = measure(prep, implementation, phase="N3")
assert all(np.isnan(value) for value in other_phase.values())
@pytest.mark.parametrize("implementation", IMPLEMENTATIONS)
def test_sleep_without_spindles_is_nan(sleep_recording, implementation):
"""Pin missing outputs on event-free sleep. Fails if any feature reports a value without a detected spindle."""
result, events = measure(sleep_recording("empty"), implementation)
assert events.empty and events.attrs["searched"]
assert all(np.isnan(value) for value in result.values())
@pytest.mark.parametrize("biomarker", (Spindles, LegacySpindles))
def test_spindle_baselines_load_without_new_features(tmp_path, biomarker):
"""Pin save/load of a single-feature baseline. Fails if train or predict requires all current feature columns."""
table = pd.DataFrame({"age_months": [12, 24, 36], DENSITY: [0.1, 0.2, 0.3]})
module = biomarker(baseline_params={"n_min": 1}).train(table)
module.save(tmp_path)
loaded = biomarker.load(tmp_path)
assert list(loaded.baselines) == [DENSITY]
assert loaded.predict(table).feature.tolist() == [DENSITY] * len(table)
+30
View File
@@ -0,0 +1,30 @@
"""What this module covers: `models.dags.estimation.estimate_frame`, from a model's output to the estimate's rows.
Fixtures: none; a two-member cohort frame built in each test.
"""
from datetime import date
import numpy as np
import pandas as pd
from models.dags.estimation import estimate_frame
COHORT = pd.DataFrame({"pac_id": [1, 2], "fecha_indice": [date(2025, 1, 1), date(2025, 2, 1)]})
def test_a_member_the_model_cannot_place_has_no_rows():
"""Pins down: a member whose risk is NaN (a combination unseen in training) is left out and the rest keep their
rows, so one such member doesn't stop the whole batch. Fails if the NaN reaches the estimate's contract."""
found = estimate_frame(COHORT, np.array([[0.1, 0.2], [np.nan, np.nan]]), [0.0, 1.0])
assert found["pac_id"].tolist() == [1, 1] and found["probabilidad"].tolist() == [0.1, 0.2]
def test_with_intervals_the_unplaced_member_is_left_out_too():
"""Pins down: with intervals, the risk block decides who is scored and each kept row has its two ends. Fails if
the blocks are read in another order or a NaN end drops a member that has a risk."""
output = np.array([[0.1, 0.05, 0.2], [np.nan, np.nan, np.nan]])
found = estimate_frame(COHORT, output, [1.0], intervals=True)
assert found[["pac_id", "probabilidad", "ic_bajo", "ic_alto"]].values.tolist() == [[1, 0.1, 0.05, 0.2]]
+11 -3
View File
@@ -75,11 +75,19 @@ def test_each_row_becomes_one_risk_at_its_horizon():
(2, d2, 3.0, 0.23, None, None)]
def test_a_risk_keeps_the_interval_the_model_gave():
"""Pins down: an estimate with `ic_bajo` and `ic_alto` stores them with each risk, and NaN (a member the model
couldn't bound) is stored as no interval. Fails if `risk_rows` drops the interval or stores NaN."""
frame = _estimate((1, 2)).assign(ic_bajo=[0.05, float("nan")], ic_alto=[0.2, float("nan")])
assert [row[4:] for row in risk_rows(frame)] == [(0.05, 0.2), (None, None)]
@pytest.mark.parametrize("frame", [_estimate((1, 1)), _estimate().assign(probabilidad=[0.1, 1.5, 0.2]),
_estimate().rename(columns={"probabilidad": "p"})])
_estimate().rename(columns={"probabilidad": "p"}),
_estimate().assign(ic_bajo=[0.2, 0.1, 0.3], ic_alto=[0.3, 0.3, 0.4])])
def test_a_malformed_estimate_stops_the_batch(frame):
"""Pins down: a member scored twice at one horizon, a probability outside 0..1, or other columns stop the batch
before anything is written. Fails if any of them reaches the database."""
"""Pins down: a member scored twice at one horizon, a probability outside 0..1, other columns, or an interval that
doesn't hold its risk stop the batch before anything is written. Fails if any of them reaches the database."""
with pytest.raises(ValueError):
risk_rows(frame)