simet.metrics.downstream_task.sample.sample_tstr¶
simet.metrics.downstream_task.sample.sample_tstr ¶
SampleTSTR ¶
Bases: SampleDownstreamTask
Toy downstream task using Train on Synth, Test on Real.
Trains the underlying model on loader.synth_downstream_dataloader and
evaluates on loader.real_downstream_dataloader, returning the final
accuracy reported by the parent implementation.
Requirements
DatasetLoadermust have been constructed with adownstream_transformso thatsynth_downstream_dataloaderandreal_downstream_dataloaderare available. Otherwise, anAttributeErrorwill be raised when accessing these attributes.
Example
task = SampleTSTR() score = task.compute(loader) # uses synth for train, real for test 0.0 <= score <= 1.0 True
compute ¶
compute(loader)
Train on synthetic, test on real, and return accuracy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader
|
DatasetLoader
|
Must expose
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Final test accuracy on the real set in |
Source code in simet/metrics/downstream_task/sample/sample_tstr.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |