langtest.transform.representation.GenderRepresentation#
- class GenderRepresentation#
Bases:
BaseRepresentation
Subclass of BaseRepresentation that implements the gender representation test.
- alias_name#
The list of test names that identify the representation measure.
- Type:
List[str]
- supported_tasks#
name of the supported task for the representation measure
- Type:
List[str]
- __init__()#
Methods
__init__
()async_run
(sample_list, model, **kwargs)Creates a task for the run method.
run
(sample_list, model, **kwargs)Computes the actual results for the Gender Representation test.
transform
(test, data, params)Compute the gender representation measure
Attributes
test_types
- async classmethod async_run(sample_list: List[Sample], model: ModelAPI, **kwargs)#
Creates a task for the run method.
- Parameters:
sample_list (List[Sample]) – The input data to be evaluated for representation test.
model (ModelAPI) – The model to be used for the computation.
- Returns:
The task for the run method.
- Return type:
asyncio.Task
- async static run(sample_list: List[Sample], model: ModelAPI, **kwargs) List[Sample] #
Computes the actual results for the Gender Representation test.
- Parameters:
sample_list (List[Sample]) – The input data to be evaluated for representation test.
model (ModelAPI) – The model factory object.
- Returns:
The list of samples with actual results.
- Return type:
List[Sample]
- classmethod transform(test: str, data: List[Sample], params: Dict) List[MinScoreQASample] | List[MinScoreSample] #
Compute the gender representation measure
- Parameters:
test (str) – name of the test
data (List[Sample]) – The input data to be evaluated for representation test.
params – parameters specified in config.
- Raises:
ValueError – If sum of specified proportions in config is greater than 1
- Returns:
Gender Representation test results.
- Return type:
Union[List[MinScoreQASample], List[MinScoreSample]]