langtest.transform.representation.EthnicityRepresentation#

class EthnicityRepresentation#

Bases: BaseRepresentation

Subclass of BaseRepresentation that implements the ethnicity 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 ethnicity representation test.

transform(test, data, params)

Compute the ethnicity representation measure

Attributes

alias_name

supported_tasks

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 ethnicity representation test.

Parameters:
  • sample_list (List[Sample]) – The input data to be evaluated for representation test.

  • model (ModelAPI) – The model to be used for evaluation.

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 ethnicity 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:

Ethnicity Representation test results.

Return type:

Union[List[MinScoreQASample], List[MinScoreSample]]