charmlab/mace

NameError: name 'generateARExplanations' is not defined

divyat09 opened this issue · 5 comments

I tried to execute the command: python batchTest.py -d adult -m lr -n zero_norm -a AR -b 0 -s 1

However, it resulted in the following error trace:

[ENV WARNING] process_synthetic_data not available
[ENV WARNING] deactivate virtualenv to allow for testing Actionable Recourse

Experimenting with dataset_string = adult
Experimenting with model_class_string = lr
Experimenting with norm_type_string = zero_norm
Experimenting with approach_string = AR
Looking for file adult.data in the /home/t-dimaha/Mace/mace/_data_main directory..
File found in current directory..

/home/t-dimaha/Mace/mace/_data_main/adult.data
Looking for file adult.test in the /home/t-dimaha/Mace/mace/_data_main directory..
File found in current directory..

/home/t-dimaha/Mace/mace/_data_main/adult.test
Replacing column WorkClass with {WorkClass_cat_0, WorkClass_cat_1, WorkClass_cat_2, WorkClass_cat_3, WorkClass_cat_4, WorkClass_cat_5, WorkClass_cat_6}
Replacing column EducationLevel with {EducationLevel_ord_0, EducationLevel_ord_1, EducationLevel_ord_2, EducationLevel_ord_3, EducationLevel_ord_4, EducationLevel_ord_5, EducationLevel_ord_6, EducationLevel_ord_7, EducationLevel_ord_8, EducationLevel_ord_9}
Replacing column MaritalStatus with {MaritalStatus_cat_0, MaritalStatus_cat_1, MaritalStatus_cat_2, MaritalStatus_cat_3, MaritalStatus_cat_4, MaritalStatus_cat_5, MaritalStatus_cat_6}
Replacing column Occupation with {Occupation_cat_0, Occupation_cat_1, Occupation_cat_2, Occupation_cat_3, Occupation_cat_4, Occupation_cat_5, Occupation_cat_6, Occupation_cat_7, Occupation_cat_8, Occupation_cat_9, Occupation_cat_10, Occupation_cat_11, Occupation_cat_12, Occupation_cat_13}
Replacing column Relationship with {Relationship_cat_0, Relationship_cat_1, Relationship_cat_2, Relationship_cat_3, Relationship_cat_4, Relationship_cat_5}
Looking for file adult.data in the /home/t-dimaha/Mace/mace/_data_main directory..
File found in current directory..

/home/t-dimaha/Mace/mace/_data_main/adult.data
Looking for file adult.test in the /home/t-dimaha/Mace/mace/_data_main directory..
File found in current directory..

/home/t-dimaha/Mace/mace/_data_main/adult.test
Replacing column WorkClass with {WorkClass_cat_0, WorkClass_cat_1, WorkClass_cat_2, WorkClass_cat_3, WorkClass_cat_4, WorkClass_cat_5, WorkClass_cat_6}
Replacing column EducationLevel with {EducationLevel_ord_0, EducationLevel_ord_1, EducationLevel_ord_2, EducationLevel_ord_3, EducationLevel_ord_4, EducationLevel_ord_5, EducationLevel_ord_6, EducationLevel_ord_7, EducationLevel_ord_8, EducationLevel_ord_9}
Replacing column MaritalStatus with {MaritalStatus_cat_0, MaritalStatus_cat_1, MaritalStatus_cat_2, MaritalStatus_cat_3, MaritalStatus_cat_4, MaritalStatus_cat_5, MaritalStatus_cat_6}
Replacing column Occupation with {Occupation_cat_0, Occupation_cat_1, Occupation_cat_2, Occupation_cat_3, Occupation_cat_4, Occupation_cat_5, Occupation_cat_6, Occupation_cat_7, Occupation_cat_8, Occupation_cat_9, Occupation_cat_10, Occupation_cat_11, Occupation_cat_12, Occupation_cat_13}
Replacing column Relationship with {Relationship_cat_0, Relationship_cat_1, Relationship_cat_2, Relationship_cat_3, Relationship_cat_4, Relationship_cat_5}
[INFO] Training lr on 15,399 samples (%70.00 of 22,000 samples)...
Training accuracy: %80.51
Testing accuracy: %79.76
[INFO] done.

                            Generating explanation for      batch #0        sample #1/1     (sample index 17148): Traceback (most recent call last):

File "batchTest.py", line 346, in
args.process_id)
File "batchTest.py", line 243, in runExperiments
standard_deviations, # used solely for feature_tweaking method
File "batchTest.py", line 118, in generateExplanations
return generateARExplanations.genExp(
NameError: name 'generateARExplanations' is not defined

The warning says '[ENV WARNING] deactivate virtualenv to allow for testing Actionable Recourse', which I think it activated from line 25 here: https://github.com/amirhk/mace/blob/master/batchTest.py#L25

But I do not understand what the fix is like I should run the code without the python environment I created?

Deactivating the virtual env does not help with testing for Actionable Recrouse. I get the following error if I try to 'import generateARExplanations'

Traceback (most recent call last):
File "", line 1, in
File "/home/t-dimaha/Mace/mace/generateARExplanations.py", line 8, in
from recourse.builder import RecourseBuilder
ModuleNotFoundError: No module named 'recourse'

I don't find any sub-directory 'recourse' in the code, is it another dependency that I have to install? I could not find it in the requirements.txt file so could your direct me to the right source for the same?

Similarly, 'import generateSATExplanantions' gives an error:

Traceback (most recent call last):
File "", line 1, in
File "/home/t-dimaha/Mace/mace/generateSATExplanations.py", line 19, in
from loadCausalConstraints import *
ModuleNotFoundError: No module named 'loadCausalConstraints'

I was able to resolve the error with 'import generateARExplanations' by installing the actionable recourse library: https://pypi.org/project/recourse/.

However, this is not included in the pip_requirements.txt file. It would be great if you update that with the right version for repoducing results.

Hi Divyat,

The specific version is indicated in the README:
2019.01 Actionable Recourse (9387e6c @ https://github.com/ustunb/actionable-recourse)

Hope this helps!