You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-27Lines changed: 30 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,65 +5,68 @@ This is a repository for **IFC1**, a novel algorithm to learn user preferences t
5
5
## Setup details:
6
6
7
7
The code has been written in python 3.11.7 and pytorch 2.2.0+cu121. The remaining requirements are all provided in the requirements.txt which can be used to install via the following commands:
8
-
* Windows: `pip install -r requirements.txt`
9
-
* Linux: `pip install -r requirements.txt`
8
+
**Windows*: `pip install -r requirements.txt`
9
+
**Linux*: `pip install -r requirements.txt`
10
10
11
11
To create the environment 'alg4' under the folder 'virtual_environment', we use (make sure that python 3.11 installed in system from before):
While using conda, you dont even need to have python 3.11 installed from before. We can use:
15
-
* Windows and Linux: `conda create -n .\virtual_environment\alg4 python=3.11`
16
+
**Windows and Linux*: `conda create -n .\virtual_environment\alg4 python=3.11`
16
17
When creating with conda, feel free to use pip therafter to install other packages - this is necessary as causal-learn and dowhy are not available on conda.
17
18
18
19
## How to use:
19
20
20
21
To run the baselines for the synthetic dataset, run the following command:
21
-
* Windows: `python .\src\baselines\compare2.py`
22
+
**Windows*: `python .\src\baselines\compare2.py`
23
+
22
24
To run the baselines for the dataset 'Give Me Some Credit', run the following command:
Make sure that folder directory names mentioned within the file are correct and valid for you. The logs will be available in the 'logs' folder under the name 'Log_comparison2.log' and 'Log_give_me_credit_alg10.log' respectively. The graphs will be available in the 'results\graphs' folder, with each user getting a different folder for compare2.py, and the whole run getting two folders for alg10_multiple_run.py.
25
28
26
29
If we want to run the individual files for a single user, try running the following command:
**Algorithm10.py** contains the actual IFC1 algorithm which has been used for the final results. The other files contain previous versions of the algorithm and are variations of it. The other important baselines that have been used are:
34
-
1. manan_algorithmic_recourse2.py -> Manan's base paper (Version 2)
35
-
2. manan_with_causality_algorithmic_recourse2.py -> Manan's base paper with causality involved (Version 2)
36
-
3. my_method_algorithmic_recourse.py -> Custom 1
37
-
4. my_method_algorithmic_recourse3.py -> Custom 2
37
+
1.***manan_algorithmic_recourse2.py*** -> Manan's base paper (Version 2)
38
+
2.***manan_with_causality_algorithmic_recourse2.py*** -> Manan's base paper with causality involved (Version 2)
Some of the other files have been shifted to a separate folder and are described as below:
40
-
* manan_algorithmic_recourse.py -> Original implementation of Manan's base paper which was later modified in version 2 (see above) to get better results and more optimized outcomes.
41
-
* manan_with_causality_algorithmic_recourse.py -> Original implementation of Manan's base paper but with added causality changes, which was later modified in version 2 (see above) to get better results and more optimized outcomes.
42
-
* my_method_algorithmic_recourse2.py -> Some older implementation of Custom 2
43
-
* my_method_algorithmic_recourse4.py -> First attempt at involving causality in Custom 2 (which is basically our actual method)
44
-
* Algorithm5.py-Algorithm9.py -> Older implementations of our full workflow, with some not involving the full causality module with causal-learn and dowhy possibly. As we approach Algorithm9 we get closer to the final full version Algorithm10.py. Algorithm10.py has the final optimized version of Algorithm9 (along with sone metric fixes).
43
+
****manan_algorithmic_recourse.py*** -> Original implementation of Manan's base paper which was later modified in version 2 (see above) to get better results and more optimized outcomes.
44
+
****manan_with_causality_algorithmic_recourse.py*** -> Original implementation of Manan's base paper but with added causality changes, which was later modified in version 2 (see above) to get better results and more optimized outcomes.
45
+
****my_method_algorithmic_recourse2.py*** -> Some older implementation of Custom 2
46
+
****my_method_algorithmic_recourse4.py*** -> First attempt at involving causality in Custom 2 (which is basically our actual method)
47
+
****Algorithm5.py***-***Algorithm9.py*** -> Older implementations of our full workflow, with some not involving the full causality module with causal-learn and dowhy possibly. As we approach Algorithm9 we get closer to the final full version Algorithm10.py. Algorithm10.py has the final optimized version of Algorithm9 (along with sone metric fixes).
45
48
46
49
### `algorithms` module
47
50
This folder contains the algorithms to generate counterfactuals. **TenthMethod.py** contains the final method to generate counterfactuals.
48
51
The other important baselines that have been used are:
49
-
1. WachterCF.py -> Manan's base paper uses this - this is the original Wachter implementation of the code along with the optimized version
50
-
2. MananWithCausalityCF.py -> Manan's base paper with causality uses this along with the optimized version
51
-
3. baseCF.py -> Base class which is the basis for all the methods
52
+
1.***WachterCF.py*** -> Manan's base paper uses this - this is the original Wachter implementation of the code along with the optimized version
53
+
2.***MananWithCausalityCF.py*** -> Manan's base paper with causality uses this along with the optimized version
54
+
3.***baseCF.py*** -> Base class which is the basis for all the methods
52
55
53
56
Some of the other files have been shifted to a separate folder and are described as below:
54
-
* FirstMethod.py-NinthMethod.py -> Older implementations of 'TenthMethod.py'. Some older ones dont have the proper causality model, some in between are unoptimized for causality (not involving the use of the dictionary) and some near the end are just similar files but used by the corresponding files Algorithm5-Algorithm9.
57
+
****FirstMethod.py***-***NinthMethod.py*** -> Older implementations of 'TenthMethod.py'. Some older ones dont have the proper causality model, some in between are unoptimized for causality (not involving the use of the dictionary) and some near the end are just similar files but used by the corresponding files Algorithm5-Algorithm9.
55
58
56
59
### `dataset_gen` module
57
-
* dataset_generator.py -> Used to create the synthetic datasets and save as csv files
58
-
* dataset_pickler.py -> Used to pickle the datasets - it may or may not be working as it was tested a long time ago
60
+
****dataset_generator.py*** -> Used to create the synthetic datasets and save as csv files
61
+
****dataset_pickler.py*** -> Used to pickle the datasets - it may or may not be working as it was tested a long time ago
59
62
60
63
### `model` module
61
-
* create_model.py -> Used to create the models we use to run our method using custom_sequential.py
62
-
* custom_sequential.py -> Model definitions are available here
63
-
* mlp_classifier.py -> Model definitions of a simple MLP model - it may not be working as of now
64
+
****create_model.py*** -> Used to create the models we use to run our method using custom_sequential.py
65
+
****custom_sequential.py*** -> Model definitions are available here
66
+
****mlp_classifier.py*** -> Model definitions of a simple MLP model - it may not be working as of now
64
67
65
68
### `scm` module
66
-
* Node.py and SCM.py-> Used to create the custom SCM models we use with MananWithCausalityCF.py
69
+
****Node.py*** and ***SCM.py***-> Used to create the custom SCM models we use with MananWithCausalityCF.py
67
70
This folder also contains causallearn, dowhy and graphviz packages in its entirety - this was done because there were some issues with respect to imports.
0 commit comments