pyrelational.oracles¶
Abstract Oracle¶
This file contains the implementation of an abstract oracle interface for PyRelationAL
- class Oracle[source]¶
Bases:
ABC
An abstract class acting as an interface for implementing concrete oracles that can interact with a pyrelational pipeline
- abstract query_target_value(data_manager: DataManager, idx: int) Any [source]¶
Method that needs to be overridden to obtain the annotations for the input index
- Parameters:
data_manager – reference to the data_manager which will load the observation if necessary
idx – index to observation which we want to query an annotation
- Returns:
the output of the oracles
- static update_annotations(data_manager: DataManager, indices: List[int]) None [source]¶
Calls upon the data_manager to update the set of labelled indices with those supplied as arguments. It will move the observations associated with the supplied indices from the unlabelled set to the labelled set. By default, any indices supplied that are already in the labelled set are untouched.
Note this does not change the target values of the indices, this is handled by a method in the oracle.
- Parameters:
data_manager – reference to the data_manager whose sets we are adjusting
indices – list of indices selected for labelling
- update_dataset(data_manager: DataManager, indices: List[int]) None [source]¶
This method serves to obtain labels for the supplied indices and update the target values in the corresponding observations of the data manager
- Parameters:
data_manager – reference to DataManager whose dataset we intend to update
indices – list of indices to observations we want updated
- static update_target_value(data_manager: DataManager, idx: int, value: Any) None [source]¶
Update the target value for the observation denoted by the index
- Parameters:
data_manager – reference to the data_manager whose dataset we want to update
idx – index to the observation we want to update
value – value to update the observation with
- static update_target_values(data_manager: DataManager, indices: List[int], values: List[Any]) None [source]¶
Updates the target values of the observations at the supplied indices
- Parameters:
data_manager – reference to the data_manager whose dataset we want to update
indices – list of indices to observations whose target values we want to update
values – list of values which we want to assign to the corresponding observations in indices
Benchmark Oracle¶
- class BenchmarkOracle[source]¶
Bases:
Oracle
An oracle designed for evaluating strategies in R&D settings, it assumes that all the observations are sufficiently annotated and returns those annotations when queried.
- query_target_value(data_manager: DataManager, idx: int) Any [source]¶
Default method is to simply return the target in the dataset
- Parameters:
data_manager – reference to the data_manager which will load the observation if necessary
idx – index to observation which we want to query an annotation
- Returns:
the output of the oracle (the target value already in the dataset)