+
    ”ckA  ã                   ón   € R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt R t	R t
]R8X  d
   ]
! 4        R# R# )zJReport centroid abstention tradeoffs on saved validation predictions only.N)ÚPath)Údigestc                 óš  a€ VR9  d   \        R4      hV R,          R,          q0R,          q@P                  R4      pV P                  RR4      pW&8X  d   \        V4      M1VR 8X  d"   V'       d   \        VP                  4       4      M	\        4       o. pV EF  pVP                  RV,           4      q˜P                  R	V,           4      q¨P                  R
4      pV	f   VR8X  d   VR8X  d   \        R4      hKb  \	        V	\
        4      '       dv   \	        V
\
        4      '       d`   \	        V\        \        34      '       dD   \	        V\        4      '       g.   \        P                  ! V4      '       d   R Tu;8:  d   R8:  g   M \        R4      hVP                  WšV34       EK  	  \        V3R lV 4       4      p. pV Fç  pV Uu. uF  qÿ^,          V8¼  g   K  VNK  	  pp\        R V 4       4      p\        V3R lV 4       4      pTP                  RTR\        V4      R\        V4      R\        V4      \        V4      ,
          RTR\        V4      V,
          RTRTRVV,
          RV'       d   V\        V4      ,          MRRV'       d   V\        V4      ,          MR/4       Ké  	  R\        V4      \        V4      ,
          RV/# u upi )!ÚgenusÚspecieszInvalid rankÚ
validationÚrecordsÚlabelsÚspecies_to_genusÚ
label_rankÚtrue_Ú
predicted_Ú
similarityNzMissing validation speciesgj¼t“ð?zInvalid validation predictionc              3   ó4   <"  € T F  w  p q!S9  x € K  	  R # 5i©N© ©Ú.0ÚtrueÚ_Úknowns   &  €ÚN/home/mchadwick/src/ansp/diatom-research/diatom_pilot/validation_thresholds.pyÚ	<genexpr>Útradeoffs.<locals>.<genexpr>   s   øé € Ð;±(¡h d¨1¨Q˜EÖ!³(ùó   ƒc              3   ó0   "  € T F  w  rq1V8H  x € K  	  R # 5ir   r   )r   r   Úpredr   s   &   r   r   r      s   é € ÐEmÑdlÑU`ÐUYÐ_`ÈDÆjÓdlùs   ‚c              3   ó4   <"  € T F  w  p q!S9  x € K  	  R # 5ir   r   r   s   &  €r   r   r      s   øé € ÐH¹x±8°4¸¸!¨Ö.»xùr   Ú	thresholdÚeligibleÚacceptedÚ	abstainedÚcorrectÚincorrect_acceptedÚunseen_truthÚunseen_acceptedÚunseen_abstainedÚfraction_correct_allÚfraction_correct_acceptedÚunmappedÚresults>   r   r   gj¼t“ð¿)Ú
ValueErrorÚgetÚsetÚvaluesÚ
isinstanceÚstrÚintÚfloatÚboolÚmathÚisfiniteÚappendÚsumÚlen)ÚmodelÚ
thresholdsÚrankr   r	   ÚmappingÚ
model_rankÚselectedÚrecordr   r   ÚscoreÚunknownr*   r   Úxr    r"   Úunknown_acceptedr   s   &&&                @r   Ú	tradeoffsrD      s—  ø€ ØÐ&Ô&¬Z¸Ó-GÐ'GØ�,Õ 	Õ*€G¸µ/¨6Ï)É)ÐTfÓJgÀ'Ø�y‰y˜ iÓ0€JØÔ*Œ3ˆvŒ;È$ÐPWÌ-×\c´°W·^±^Ó5EÔ1FÔilÓin€EØ€HÜˆØ�Z‰Z˜ �Ó%ˆ¯:©:°lÀ4Õ6GÓ+H dÏzÉzÐZfÓOgÈØŠ<Ø�YŒ :¨yÔ#8¼zÐJfÓ?gÐ9gÙÜ˜$œs×#Ò#¬:°d¼3×+?Ò+?ÄzÐRWÔY\Ô]bÐXc×GdÒGdÔhrÐsxÔy}×h~Òh~ô  GK÷  GTò  GTð  UZ÷  G[ò  G[ð  cið  kpö  cwð  rwö  cwÜÐ<Ó=Ð=Ø�‰˜ 5Ð)×*ñ ô Ô;±(Ó;Ó;€GÀB¸GÛˆ	Ù%Ó9™X˜¨1­¨y©—!�!™XˆÐ9Ä#ÑEmÑdlÓEmÓBm¸'ÜÔH¹xÓHÓHÐØ�‰˜ I¨j¼¸X»ÀzÔRUÐV^ÓR_Ð`kÔloÐpxÓlyÔz}ð  Gó  {Hõ  mHØ! 'Ð*>¼sÀ8»}ÈWÕ?TÐUcÐdkØ)Ð*:Ð;MÈgÐVfÕNfØ.Ï¨w´s¸8³}Ö/DÐVZØ3ÏX°G¼CÀ»MÖ4IÐ[_ð	aö 	bñ  ð ”s˜7“|¤C¨£MÕ1°)¸GÐDÐDùò :s   ÇKÇKc                  ó*  € \         P                  ! \        R 7      q P                  R\        RR7       V P                  R\        RR7       V P                  R\
        RRR7       V P                  4       qP                  R	,          p\        P                  ! VP                  4       4      pVP                  R
4      R8w  g   VP                  R4      R8w  d   \        R4      h\        VP                  R,          4      VP                  R4      8w  d   \        R4      hVP                  R/ 4      P                  R4      p\        V\        4      '       d	   V'       g   \        R4      hVP                   e   VP                   M. R7Op\"        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   \        R4      h\%        \'        V4      4      p\)        W5R4      p\)        W5R4      pVP*                  P-                  4       '       d5   \#        VP*                  P/                  4       4      '       d   \1        R4      hVP*                  P3                  RRR7       R
RR\        V4      RVR,          R \5        V4      R!VR!,          RVRVR"R#/pVP*                  R$,          P7                  \        P8                  ! V^R%7      R&,           4       . p	R'V3R(V33 FW  w  r«R)P;                  R* VR+,           4       4      pV	P=                  R,V
 R-VR.,           R/V
P?                  4        R0V R12	4       KY  	  VP*                  R2,          P7                  R3R)P;                  V	4      ,           R4,           4       \A        R5\5        V4       R624       R# )8)Údescriptionz--modelT)ÚtypeÚrequiredz--outputz--thresholdr6   z4Similarity threshold; repeat to set an explicit grid)rG   ÚactionÚhelpz
model.jsonÚformatzdiatom-centroid-classifier-v1Útest_statusz test images not opened or scoredzInvalid model provenancezcentroids.npzÚcentroids_sha256zCentroid hash mismatchr   r   zNo saved validation predictionsNc              3   óž   "  € T FC  p\         P                  ! V4      '       * ;'       g    RTu;8*  ;'       d    ^8*  Mu '       * x € KE  	  R# 5i)é   Néÿÿÿÿ)r4   r5   ©r   rB   s   & r   r   Úmain.<locals>.<genexpr>.   s3   é € Ð
D¹°AŒt�}Š}˜QÓÔ×/Ð/ r¨1§x¤x¨a¤x¤<Ô/»ùs
   ‚&A©$AFz.Thresholds must be finite and between -1 and 1r   r   zOutput directory must be empty)ÚparentsÚexist_okz#diatom-centroid-threshold-report-v1Úmodel_sha256Úvalidation_samplesÚvalidation_rowsÚprovisional_usedÚwarningz¼Validation-only development diagnostic on preselected crops; similarities are not probabilities. Threshold selection can overfit; no independent test or end-to-end accuracy is established.zthresholds.json)ÚindentÚ
ÚSpeciesÚGenusÚ c              3   óÞ   "  € T Fc  pR VR,          R RVR,           RVR,           RVR,           RVR,           RVR,           RVR,           RVR,           RVR	,           R
2x € Ke  	  R# 5i)z<tr><td>r   z.2fz	</td><td>r    Ú/r   r"   r%   r$   z
</td></tr>Nr   rQ   s   & r   r   rR   8   s  é € ð  Dñ  rCð  mn�x  +¥¨sÐ3°9¸Q¸z½]¸OÈ1ÈQÈzÍ]ÈOÐ[dÐefÐgpÕeqÐdrÐrsÐtuð  wAõ  uBð  tCð  CLð  MNð  OXõ  MYð  LZð  Z[ð  \]ð  ^hõ  \ið  [jð  jsð  tuð  vGõ  tHð  sIð  IJð  KLð  M[õ  K\ð  J]ð  ]gõ  hó  rCùs   ‚A+A-r*   z<section><h2>z</h2><p>r)   z validation labels lack a zå mapping and are excluded from this table.</p><table><thead><tr><th>Threshold</th><th>Accepted / eligible</th><th>Correct / eligible</th><th>Correct / accepted</th><th>Unseen truth accepted / unseen truth</th></tr></thead><tbody>z</tbody></table></section>z
index.htmlaP  <!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Validation threshold tradeoffs</title><style>body{font:16px/1.5 system-ui;color:#1c3835;max-width:1000px;margin:2em auto;padding:0 1em}table{border-collapse:collapse}td,th{border:1px solid #aaa;padding:.4em}section{overflow:auto;border-top:1px solid #aaa}</style><h1>Validation threshold tradeoffs</h1><p>Development crops only; similarity is not a probability. Every suggestion below the threshold is treated as an abstention. A threshold chosen on these same examples may overfit, and these results do not measure field detection or final accuracy. Unseen truth means the reference species or genus is absent from training; it does not cover debris or every possible unknown.</p><p><a href="thresholds.json">Data and provenance</a></p>z</html>zWrote validation tradeoffs for z" crops; no threshold was selected.)
g      ð¿g        g      Ð?g      à?g333333ã?gffffffæ?gš™™™™™é?gÍÌÌÌÌÌì?gffffffî?g      ð?)!ÚargparseÚArgumentParserÚ__doc__Úadd_argumentr   r2   Ú
parse_argsr9   ÚjsonÚloadsÚ	read_textr,   r+   r   r/   Úlistr   ÚanyÚsortedr-   rD   ÚoutputÚexistsÚiterdirÚFileExistsErrorÚmkdirr8   Ú
write_textÚdumpsÚjoinr6   ÚlowerÚprint)ÚpÚaÚmanifestr9   r   r:   r   r   ÚresultÚblocksr;   r.   Úrowss                r   Úmainr|   %   sq  € Ü×Ò¬'Ô2€A·>±>À)ÔQUÐ_c°>Ô3dÐef×esÑesÐt~ô  EIð  SWÐesô  fXØ‡N�N�=¤e°8ÐAw€NÔxØ‡l�lƒn€AŸg™g lÕ2�X¼¿ºÀH×DVÑDVÓDXÓ9Y°5Ø‡y�y�ÓÐ;Ô;¸u¿y¹yÈÓ?WÐY{Ô?{ô  CMð  Nhó  Cið  }iÜˆa�g‰g�oÕ%Ó&¨¯	©	Ð2DÓ(EÔEÌJÐWoÓLpÐFpØ�I‰I�l 2Ó&×*Ñ*¨9Ó5€GÜ�gœd×#Ò#¯7¼ÐDeÓ9fÐ3fØŸk™kÒ5ˆq�{Š{Ò;`€Jß
ƒsÑ
D¹Ó
D‡s‡s‚sÑ
D¹Ó
D×DÒDÌ:ð  WGó  LHð  FHÜ”c˜*“oÓ&€J¬y¸È)Ó/T wÔ[dÐejÐv}Ó[~ÐUZØ‡x�x‡�×ÒœS §¡×!1Ñ!1Ó!3×4Ò4¼?ÐKkÓ;lÐ5lØ‡H�H‡N�N˜4¨€NÔ.ØÐ:¸>Ì&ÐQYÓJZÐ[oÐpuð  wKõ  qLØœc '›lÐ+=¸eÐDVÕ>WÐXaÐbiÐjqÐrwØð  UðV€Fð ‡X�XÐÕ×+Ñ+¬D¯JªJ°vÀQÔ,GÈÕ,LÔMØ€FØ" 7Ð+¨W°U¨OÓ<‰ˆØ�W‰Wñ  Dð  rxð  yBö  rCó  Dó  DˆØ�‰˜ d V¨8°F¸:Õ4FÐ3GÐGaÐbf×blÑblÓbnÐaoð  pUð  VZð  U[ð  [uð  vö  	wñ =ð ‡X�XˆlÕ×&Ñ&ð  (~ð  A÷  Fñ  Fð  GMó  Nõ  (Nð  OXõ  (Xô  YÜ	Ð+¬C°«L¨>Ð9[Ð
\Ö]ó    Ú__main__)rc   ra   Úhtmlrf   r4   Úpathlibr   Úingest_reviewr   rD   r|   Ú__name__r   r}   r   Ú<module>rƒ      s7   ðÙ PÛ Û Û Û Ý å  òEò4^ð2 ˆZÔ™žÑr}   