nlptest.augmentation.AugmentRobustness#
- class AugmentRobustness(task, h_report, config, max_prop=0.5)#
Bases:
BaseAugmentaion
A class for performing a specified task with historical results.
- task#
A string indicating the task being performed.
- Type:
str
- config#
A dictionary containing configuration parameters for the task.
- Type:
dict
- h_report#
A DataFrame containing a report of historical results for the task.
- Type:
pandas.DataFrame
- max_prop#
The maximum proportion of improvement that can be suggested by the class methods. Defaults to 0.5.
- Type:
float
- __init__(self, task, h_report, config, max_prop=0.5) None #
Initializes an instance of MyClass with the specified parameters.
- fix(self) List[Sample] #
.
- suggestions(self, prop) pandas.DataFrame #
Calculates suggestions for improving test performance based on a given report.
- __init__(task, h_report, config, max_prop=0.5) None #
Initializes an instance of MyClass with the specified parameters.
- Parameters:
task (str) – A string indicating the task being performed.
h_report (pandas.DataFrame) – A DataFrame containing a report of historical results for the task.
config (dict) – A dictionary containing configuration parameters for the task.
max_prop (float) – The maximum proportion of improvement that can be suggested by the class methods. Defaults to 0.5.
- Returns:
None
Methods
__init__
(task, h_report, config[, max_prop])Initializes an instance of MyClass with the specified parameters.
fix
(input_path, output_path[, inplace])Applies perturbations to the input data based on the recommendations from harness reports.
suggestions
(report)Calculates suggestions for improving test performance based on a given report.
- fix(input_path: str, output_path, inplace: bool = False)#
Applies perturbations to the input data based on the recommendations from harness reports.
- Parameters:
input_path (str) – The path to the input data file.
output_path (str) – The path to save the augmented data file.
inplace (bool, optional) – If True, the list of samples is modified in place. Otherwise, a new samples are add to input data. Defaults to False.
- Returns:
A list of augmented data samples.
- Return type:
List[Dict[str, Any]]
- suggestions(report)#
Calculates suggestions for improving test performance based on a given report.
- Parameters:
report (pandas.DataFrame) – A DataFrame containing test results by category and test type, including pass rates and minimum pass rates.
- Returns:
- A DataFrame containing the following columns for each suggestion:
category: the test category
test_type: the type of test
ratio: the pass rate divided by the minimum pass rate for the test
- proportion_increase: a proportion indicating how much the pass rate
should increase to reach the minimum pass rate
- Return type:
pandas.DataFrame