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