Source code for HALF.Oracle.SimulatedOracle
from HALF.Interfaces import IOracle
from torch.utils.data import Dataset
[docs]class SimulatedOracle(IOracle):
"""
Fake Oracle when the dataset is already labeled and we are working in an analysis context instead of real world application
"""
[docs] def __init__(self, dataset: Dataset=None):
"""Initialize Oracle
Args:
dataset (Dataset, optional): Dataset containing information required to simulate the oracle. Defaults to None.
"""
self.dataset = dataset
[docs] def query(self, sub_ulb_ds: Dataset) -> Dataset:
"""Labels the dataset
Args:
sub_ulb_ds (Dataset): The unlabeled dataset to be labeled by the Oracle
Returns:
Dataset: The labeled dataset
"""
return sub_ulb_ds