Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7930bfa
name fix
ArshaanNazir Mar 16, 2023
478d576
add representation test classes
ArshaanNazir Mar 16, 2023
22207c9
update utils
ArshaanNazir Mar 16, 2023
9572230
add label_representation test
ArshaanNazir Mar 16, 2023
97b4211
add ReligionRepresentation test
ArshaanNazir Mar 16, 2023
bfc20c7
Add CountryEconomicRepresentation Test
ArshaanNazir Mar 16, 2023
5a18af2
remove unnecessary code
ArshaanNazir Mar 16, 2023
a11c593
update names as per specified format
ArshaanNazir Mar 16, 2023
9718ed9
Updated LabelRepresentation with proportion test
ArshaanNazir Mar 16, 2023
c4f9343
update representation tests
ArshaanNazir Mar 21, 2023
7e4196c
update custom_types
ArshaanNazir Mar 21, 2023
749114a
update imports
ArshaanNazir Mar 21, 2023
43b7400
update testfactory representation transform
ArshaanNazir Mar 21, 2023
719b7c9
update config with representation tests
ArshaanNazir Mar 21, 2023
de0a381
update LabelRepresentation test
ArshaanNazir Mar 21, 2023
638507f
add get_entity_representation_dict to utils
ArshaanNazir Mar 21, 2023
ba9dc42
update __init__ representation
ArshaanNazir Mar 21, 2023
008427a
add state conditions
ArshaanNazir Mar 21, 2023
71826eb
get_entity_representation -> get_label_representation_dict
ArshaanNazir Mar 21, 2023
f6c3329
add CountryEconomicRepresentation test
ArshaanNazir Mar 21, 2023
b8c4c72
add ReligionRepresentation test
ArshaanNazir Mar 21, 2023
958a928
add EthnicityRepresentation test
ArshaanNazir Mar 21, 2023
84b1bdf
update representation config
ArshaanNazir Mar 21, 2023
724e4ae
add get_entity_representation_proportions function
ArshaanNazir Mar 21, 2023
acee6da
syntax fix
ArshaanNazir Mar 21, 2023
847d42b
update configs
ArshaanNazir Mar 22, 2023
31dc3a3
add docstrings to representation tests
ArshaanNazir Mar 22, 2023
7b46291
adding docstrings for helper functions in utils
ArshaanNazir Mar 22, 2023
37dff9e
update docstrings
ArshaanNazir Mar 22, 2023
4b4ac12
Merge branch 'release/0.0.8' into add_representation_tests
ArshaanNazir Mar 22, 2023
f14ff20
correct name
ArshaanNazir Mar 22, 2023
6d37e2a
Merge branch 'release/0.0.8' into add_representation_tests
ArshaanNazir Mar 22, 2023
26eabd4
update config
ArshaanNazir Mar 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 49 additions & 7 deletions demo/data/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
defaults:
min_pass_rate: 0.65
min_representation: 50
tests:
accuracy:
min_micro_f1_score:
Expand Down Expand Up @@ -36,16 +35,59 @@ tests:
min_pass_rate: 0.70
replace_to_hindu_names:
min_pass_rate: 0.66

robustness:
lowercase:
min_pass_rate: 0.65
swap_entities:
min_pass_rate: 0.65
uppercase:
min_pass_rate: 0.65
add_context:
min_pass_rate: 0.65
parameters:
ending_context: ['Bye', 'Reported']
starting_context: ['Hi', 'Good morning', 'Hello']

representation:
min_label_representation_count:
min_count:
O : 50
PER: 10
LOC: 40

min_ethnicity_name_representation_count:
min_count:
white : 50
black: 10
asian: 40
hispanic: 30

min_ethnicity_name_representation_proportion:
min_proportion:
white : 0.20
black: 0.36

min_religion_name_representation_count:
min_count:
christian: 10
muslim : 5
hindu: 8
parsi: 40
sikh: 10

min_religion_name_representation_proportion:
min_proportion:
muslim : 0.4
hindu: 0.5

min_country_economic_representation_count:
min_count:
high_income: 10
low_income: 10

min_label_representation_proportion:
min_proportion:
O: 0.4
PER: 0.2
LOC: 0.1

min_country_economic_representation_proportion:
min_proportion:
high_income: 0.6
low_income: 0.1
50 changes: 50 additions & 0 deletions demo/data/representation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
defaults:
min_pass_rate: 0.65
tests:
representation:
min_label_representation_count:
min_count:
O : 50
PER: 10
LOC: 40

min_ethnicity_name_representation_count:
min_count:
white : 50
black: 10
asian: 40
hispanic: 30

min_ethnicity_name_representation_proportion:
min_proportion:
white : 0.20
black: 0.36

min_religion_name_representation_count:
min_count:
christian: 10
muslim : 5
hindu: 8
parsi: 40
sikh: 10

min_religion_name_representation_proportion:
min_proportion:
muslim : 0.4
hindu: 0.5

min_country_economic_representation_count:
min_count:
high_income: 10
low_income: 10

min_label_representation_proportion:
min_proportion:
O: 0.4
PER: 0.2
LOC: 0.1

min_country_economic_representation_proportion:
min_proportion:
high_income: 0.6
low_income: 0.1
8 changes: 4 additions & 4 deletions nlptest/transform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,15 @@ def transform(self):
List[Sample]
A list of `Sample` objects representing the resulting dataset after running the robustness test.
"""

all_samples = []
all_samples = []
for test_name, params in self.tests.items():
data_handler_copy = [x.copy() for x in self._data_handler]
transformed_samples = self.supported_tests[test_name].transform(data_handler_copy,
**params.get('parameters', {}))
transformed_samples = self.supported_tests[test_name].transform(test_name,data_handler_copy, params)
for sample in transformed_samples:
sample.test_type = test_name
all_samples.extend(transformed_samples)

return all_samples

@classmethod
Expand Down
Loading