Skip to content
Snippets Groups Projects
Commit 0afe57b7 authored by Oceane's avatar Oceane
Browse files

Example

parent d2975c6d
No related branches found
No related tags found
No related merge requests found
File added
File added
perception_severity/socialSupport_emotionality
norm_fulfillment/empowerment_abilities
perception_vulnerability/empowerment_desires
File added
File added
,behavior_sexualRisk,behavior_eating,behavior_personalHygine,intention_aggregation,intention_commitment,attitude_consistency,attitude_spontaneity,norm_significantPerson,norm_fulfillment,perception_vulnerability,perception_severity,motivation_strength,motivation_willingness,socialSupport_emotionality,socialSupport_appreciation,socialSupport_instrumental,empowerment_knowledge,empowerment_abilities,empowerment_desires,ca_cervix
0,10,13,12,4,7,9,10,1,8,7,3,14,8,5,7,12,12,11,8,1
1,10,11,11,10,14,7,7,5,5,4,2,15,13,7,6,5,5,4,4,1
2,10,15,3,2,14,8,10,1,4,7,2,7,3,3,6,11,3,3,15,1
3,10,11,10,10,15,7,7,1,5,4,2,15,13,7,4,4,4,4,4,1
4,8,11,7,8,10,7,8,1,5,3,2,15,5,3,6,12,5,4,7,1
5,10,14,8,6,15,8,10,1,3,4,2,14,8,7,2,7,13,9,6,1
6,10,15,4,6,14,6,10,5,3,7,2,7,13,3,3,15,3,3,5,1
7,8,12,9,10,10,5,10,5,5,5,2,10,9,13,2,9,8,7,12,1
8,10,15,7,2,15,6,10,1,3,5,2,9,15,13,10,15,13,15,15,1
9,7,15,7,6,11,8,8,5,3,3,4,15,3,8,2,9,3,4,4,1
10,7,15,7,10,14,7,9,1,3,8,2,4,3,7,9,13,8,3,9,1
11,10,15,8,9,15,7,10,1,3,7,2,15,3,3,6,13,7,5,9,1
12,10,15,12,10,15,6,10,1,3,3,2,4,3,3,2,15,13,6,11,1
13,9,12,14,9,15,10,9,3,6,3,2,15,15,3,10,15,11,3,11,1
14,2,15,15,6,13,8,9,1,3,3,4,15,3,7,6,7,7,7,3,1
15,10,15,7,6,14,8,8,4,8,10,2,3,3,3,2,5,5,5,3,1
16,10,15,9,7,6,8,8,1,12,5,4,5,4,3,3,5,7,7,3,1
17,10,12,7,5,10,8,8,1,8,10,4,6,3,3,2,4,4,3,5,1
18,10,11,12,2,10,8,8,2,10,8,7,6,5,3,2,4,4,4,3,1
19,10,12,12,8,10,8,6,2,7,6,2,12,11,9,8,12,10,10,9,1
20,10,15,15,4,15,8,10,5,3,8,3,11,3,3,2,7,8,5,3,1
21,10,12,11,10,15,7,8,3,3,3,2,13,11,10,7,12,12,12,12,0
22,10,13,14,10,15,6,8,1,5,5,2,15,10,12,8,15,15,15,15,0
23,10,15,13,10,15,2,10,1,5,6,2,14,14,14,8,14,15,14,15,0
24,10,12,10,7,15,6,8,2,4,9,2,15,12,10,7,12,14,10,14,0
25,10,15,13,10,15,6,10,1,3,5,2,15,13,9,7,12,15,11,15,0
26,10,13,15,8,13,7,8,3,5,9,2,13,11,12,9,10,12,13,12,0
27,10,15,11,10,15,8,10,1,3,3,2,15,13,13,10,15,15,13,15,0
28,10,11,11,10,14,5,8,1,4,3,4,15,11,13,9,13,13,12,13,0
29,10,14,10,9,15,4,5,2,5,7,3,10,7,4,6,7,5,9,12,0
30,10,8,9,10,15,10,10,1,3,3,2,15,13,11,6,15,15,10,15,0
31,10,15,15,8,9,8,9,4,7,6,4,12,12,14,9,14,13,9,12,0
32,10,10,11,10,15,5,8,1,5,3,6,15,13,13,10,15,13,13,13,0
33,10,11,10,9,15,5,10,3,3,3,2,11,11,9,4,9,15,15,15,0
34,10,15,15,10,15,10,10,1,3,3,2,15,10,10,10,15,15,15,15,0
35,10,3,5,2,9,6,10,1,3,9,6,11,10,9,9,14,6,10,10,0
36,10,15,9,3,15,8,10,1,3,5,6,10,15,13,10,15,15,15,15,0
37,10,10,12,5,7,6,6,4,5,10,4,11,9,11,8,11,11,10,11,0
38,10,9,11,10,15,7,6,1,3,6,2,15,15,15,10,15,15,15,14,0
39,10,14,14,10,11,5,9,1,5,4,2,14,15,11,8,14,13,13,13,0
40,10,12,11,10,15,7,8,3,3,4,2,14,7,9,8,12,15,10,14,0
41,10,15,13,10,15,6,10,1,7,7,2,15,7,3,4,3,11,5,9,0
42,10,15,15,10,15,8,8,5,11,15,10,15,15,15,10,15,15,15,15,0
43,10,15,15,10,15,9,10,5,11,15,10,15,15,15,10,15,15,15,15,0
44,10,11,14,10,15,10,10,5,15,14,10,15,9,9,4,3,14,11,15,0
45,10,15,14,10,11,10,8,5,11,15,10,15,15,15,10,15,15,15,15,0
46,10,14,11,10,15,9,10,5,15,15,10,15,13,6,6,12,15,11,14,0
47,10,15,15,6,11,7,6,5,11,13,10,15,15,11,10,15,11,11,15,0
48,10,15,11,10,15,8,10,1,15,15,10,15,13,3,2,9,15,8,11,0
49,6,15,11,10,12,8,10,5,14,13,10,15,7,5,2,5,13,9,3,0
50,10,11,15,10,11,6,10,5,15,11,10,15,15,15,6,9,15,15,9,0
51,10,15,15,10,15,10,10,5,15,14,9,9,13,12,9,15,15,15,15,0
52,10,9,12,10,14,9,6,5,11,11,9,15,11,3,2,6,13,7,3,0
53,10,13,12,2,15,7,10,5,15,10,2,15,12,11,7,6,10,9,12,0
54,10,15,15,10,11,7,8,5,15,13,10,15,15,11,8,15,15,13,11,0
55,10,9,8,2,15,6,10,1,15,15,8,11,11,13,10,15,13,13,10,0
56,10,10,5,2,15,8,10,5,13,15,10,15,3,3,2,13,15,15,15,0
57,10,11,8,10,15,7,8,5,14,13,8,12,7,4,3,3,4,4,7,0
58,10,11,9,6,15,6,8,5,14,11,8,11,7,3,2,3,3,3,3,0
59,10,13,9,10,15,8,8,5,14,8,8,11,3,3,2,3,3,3,3,0
60,10,12,10,10,15,6,8,5,15,11,8,13,7,3,2,3,3,3,3,0
61,10,10,10,10,15,6,6,5,14,13,9,15,9,13,8,14,13,12,12,0
62,10,13,11,6,15,8,10,5,15,7,10,13,7,3,5,3,3,3,3,0
63,10,13,15,10,15,8,10,5,14,6,8,13,7,3,4,3,3,6,3,0
64,10,15,8,6,11,6,10,5,11,15,8,15,7,3,4,11,13,10,15,0
65,10,13,11,6,14,9,10,5,15,15,10,15,3,3,4,7,7,7,11,0
66,10,12,13,10,11,7,7,5,14,15,9,14,10,6,6,6,9,7,11,0
67,10,14,14,10,15,6,7,5,15,14,10,15,13,9,8,12,12,11,9,0
68,10,12,15,10,15,8,8,5,15,14,8,12,14,11,7,13,15,11,14,0
69,10,8,11,6,10,6,4,3,13,9,8,14,12,9,7,11,12,10,10,0
70,9,12,13,10,13,6,6,5,14,13,10,13,12,11,8,12,11,13,15,0
71,10,14,14,6,12,7,8,5,15,12,10,10,13,11,9,14,13,15,15,0
......@@ -35,6 +35,15 @@ python3 run_mem.py -h
```
### Example
In the Example subrepository, you can find a dataset and the output files that you would obtain by running the following command line:
```python
python3 run_mem.py sobar-72.csv --nbcpus 12 --target ca_cervix
```
The dataset comes from the UCI Machine Learning Repository ([dataset](https://archive.ics.uci.edu/ml/datasets/Cervical+Cancer+Behavior+Risk)). It dataset contains 19 attributes regarding cervical cancer behavior risk with class label is ca_cervix with 1 and 0 as values which means the respondent with and without cervical cancer, respectively.
## References
[1] Stout, Q.F. Isotonic Regression via Partitioning. Algorithmica 66, 93–112 (2013). https://doi.org/10.1007/s00453-012-9628-4
......
......@@ -12,6 +12,7 @@ import numpy as np
import pandas as pd
import sys
import argparse
import os
def parse_args():
parser=argparse.ArgumentParser(description="Monotonic Ensemble Model approach")
......@@ -39,10 +40,10 @@ def verify_nb_classes_dataset(df, target):
def modify_label_classes_dataset(df, target):
if not set(df[target]) == {0,1}:
tt = list(set(df[target]))
df[target] = df[target].map({tt[0]:0,tt[1]:1})
df.rename({target:'target'}, axis=1, inplace=True)
df.rename({target:'target'}, axis=1, inplace=True)
if not set(df['target']) == {0,1}:
tt = list(set(df['target']))
df[target] = df['target'].map({tt[0]:0,tt[1]:1})
return df
......@@ -60,10 +61,15 @@ def main():
df.reset_index(drop=True, inplace=True)
except:
print("Can't open the file {}. Check the format.\n".format(inputs.dataset))
if not os.path.isdir(inputs.outdir):
os.makedirs(inputs.outdir)
print("Outdir created")
if not verify_nb_classes_dataset(df, inputs.target):
sys.exit()
df = modify_label_classes_dataset(df, inputs.target)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment