36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
"""55ffc6f9: one complete100epoch schedule, not a200epoch midpoint."""
|
|
import math
|
|
|
|
|
|
def lr_epoch(epoch):
|
|
if type(epoch) is not int or not 1<=epoch<=100:
|
|
raise ValueError('Fixed integer epochs1..100')
|
|
if epoch<=5:
|
|
return 1e-4+(epoch-1)*(1e-3-1e-4)/4
|
|
return 1e-5+(1e-3-1e-5)*(1+math.cos(math.pi*(epoch-5)/95))/2
|
|
|
|
|
|
def selected_checkpoint(completed_epochs):
|
|
if type(completed_epochs) is not int or completed_epochs!=100:
|
|
raise ValueError('Only last complete epoch100, no midpoint/best selection')
|
|
return 'last-epoch100.pt'
|
|
|
|
|
|
def screen_decision(delta_short,delta_seed):
|
|
"""Future validation-screen policy only; this module never reads labels."""
|
|
if delta_short is None or delta_seed is None:
|
|
return 'WAIT_MATCHED_VALIDATION_AND_SEED_REFERENCE'
|
|
if not all(math.isfinite(x) for x in (delta_short,delta_seed)):
|
|
raise ValueError('Invalid matched validation differences')
|
|
return 'PASS' if delta_short<=-.001 and abs(delta_short)>abs(delta_seed) else 'SCREENED_OUT'
|
|
|
|
|
|
def test_confirmation(delta_short,ci_high,delta_seed,parts,components):
|
|
if parts!=552 or components!=204:
|
|
return 'INCOMPLETE_NO_CONFIRMATION'
|
|
if any(x is None for x in (delta_short,ci_high,delta_seed)):
|
|
return 'WAIT_MATCHED_TEST_AND_SEED_REFERENCE'
|
|
if not all(math.isfinite(x) for x in (delta_short,ci_high,delta_seed)):
|
|
raise ValueError('Invalid matched test differences')
|
|
return 'PASS' if ci_high<-.001 and abs(delta_short)>abs(delta_seed) else 'NOT_CONFIRMED'
|