RAMEN Usage Example

This page shows an example of using RAMEN.

You can access the example dataset in our github: https://github.com/mcgilldinglab/RAMEN/tree/main/ramen/csv

[ ]:
from ramen.Ramen import Ramen
[2]:
long = "Long Covid"
bowl = Ramen( "ramen/csv/example.csv", end_string = long, min_values = 200 )
Starting removing vars with too few values, vectorizing dataframe, and initializing mutual information matrix, this might take a few minutes.
Removed 7 variables because of insufficient data. If deleted too many, please adjust the bad_var_threshold
done
[3]:
bowl.random_walk( 10, 5000, 7, p_value = 0.05, correction = "no_correction" )
Optimization terminated successfully.
         Current function value: 0.808345
         Iterations: 12
         Function evaluations: 13
         Gradient evaluations: 13
[4]:
bowl.genetic_algorithm( hard_stop = 10 )
75
initializing scorer
done initializing scorer
making candidates
Finished making candidates in: 1.1916895729955286
starting Genetic Algorithm
-38.77012749727795
generation: 0 best: -38.094838260030954
generation: 1 best: -37.949937886940624
generation: 2 best: -37.56985959866779
generation: 3 best: -37.20360603750589
generation: 4 best: -36.70837017174945
generation: 5 best: -36.46075223887123
generation: 6 best: -36.219902252398086
generation: 7 best: -35.89611906192293
generation: 8 best: -35.393485696785945
generation: 9 best: -35.18337559201184
[5]:
bowl.network
[5]:
<networkx.classes.digraph.DiGraph at 0x7f451be9a820>
[6]:
list(bowl.network.edges)
[6]:
[('ACE inhibitor or Angiotensin Receptor Blocker?', 'Long Covid'),
 ('ACE inhibitor or Angiotensin Receptor Blocker?', 'Wheezing or stridor ?'),
 ('Wheezing or stridor ?', 'Long Covid'),
 ('Abdominal pain ?', 'Asymptomatic?'),
 ('Abdominal pain ?', 'Long Covid'),
 ('Asymptomatic?', 'Confusion / altered mental status ?'),
 ('Asymptomatic?', 'Diarrhea ?'),
 ('Asymptomatic?', 'Fatigue ?'),
 ('Asymptomatic?', 'Joint pain (Arthralgia) ?'),
 ('Asymptomatic?', 'Long Covid'),
 ('Asymptomatic?', 'Loss of appetite ?'),
 ('Age au recrutement:', 'Long Covid'),
 ('Anticoagulants?', 'ACE inhibitor or Angiotensin Receptor Blocker?'),
 ('Anticoagulants?', 'Colchicine?'),
 ('Anticoagulants?', 'Long Covid'),
 ('Anticoagulants?', 'Loss of taste / lost of smell ?'),
 ('Anticoagulants?', 'Systemic corticosteroid?'),
 ('Colchicine?', 'Long Covid'),
 ('Loss of taste / lost of smell ?', 'Long Covid'),
 ('Systemic corticosteroid?', 'Long Covid'),
 ('Systemic corticosteroid?', 'Muscle aches (Myalgia) ?'),
 ('Systemic corticosteroid?', 'Other immunosuppressive medications?'),
 ('Arterial Hypertension ?', 'Long Covid'),
 ('Asthma ?', 'Long Covid'),
 ('Confusion / altered mental status ?', 'Long Covid'),
 ('Diarrhea ?', 'Long Covid'),
 ('Fatigue ?', 'Long Covid'),
 ('Joint pain (Arthralgia) ?', 'Long Covid'),
 ('Loss of appetite ?', 'Long Covid'),
 ('Atrial fibrillation or flutter ?', 'Long Covid'),
 ('BMI:', 'Long Covid'),
 ('COPD (emphysema, chronic bronchitis) ?', 'Long Covid'),
 ('Chest pain ?', 'Asymptomatic?'),
 ('Chest pain ?', 'Long Covid'),
 ('Chronic hematologic disease ?', 'Long Covid'),
 ('Chronic kidney disease ?', 'Long Covid'),
 ('Coronary artery disease ?', 'Long Covid'),
 ('Cough ?', 'Anticoagulants?'),
 ('Cough ?', 'Long Covid'),
 ('Dementia ? ', 'Long Covid'),
 ('Diabetes ?', 'Long Covid'),
 ('Dizziness ?', 'Long Covid'),
 ('Drugs?', 'Long Covid'),
 ('Ear pain ?', 'Long Covid'),
 ('Electronic cigarettes?', 'Long Covid'),
 ('Extremity weakness or numbness ?', 'Long Covid'),
 ('Fever (?38.0 Celcius) ?', 'Long Covid'),
 ('HGO or insulin?', 'Long Covid'),
 ('HIV or AIDS ?', 'Long Covid'),
 ('HIV or AIDS ?', 'Other immunosuppressive medications?'),
 ('Other immunosuppressive medications?', 'Colchicine?'),
 ('Other immunosuppressive medications?', 'HGO or insulin?'),
 ('Other immunosuppressive medications?', 'Long Covid'),
 ('Headache ?', 'Long Covid'),
 ('Heart failure ?', 'Long Covid'),
 ('Height in m:', 'Long Covid'),
 ('Hemoptysis / Bloody sputum ?', 'Long Covid'),
 ('If a screening test for SARS-CoV-2 by PCR was performed, what is the most severe severity level (according to WHO) achieved?',
  'Long Covid'),
 ('Immunosupressed state?', 'Long Covid'),
 ('Is the participant employed as a Healthcare Worker?  ', 'Long Covid'),
 ('Is the participant employed in a Microbiology Laboratory?  ', 'Long Covid'),
 ('Leg swelling (Edema) ?', 'Long Covid'),
 ('Liver disease ?', 'Long Covid'),
 ('Malignant neoplasm ?', 'Long Covid'),
 ('Malnutrition ?', 'Long Covid'),
 ('Muscle aches (Myalgia) ?', 'Long Covid'),
 ('Nausea / vomiting ?', 'Long Covid'),
 ('Number of comorbidities: ', 'Long Covid'),
 ('Obesity ?', 'Long Covid'),
 ('Other chronic cardiac disease ?', 'Long Covid'),
 ('Other chronic lung disease ? ', 'Long Covid'),
 ('Other chronic neurological disorder (other than stroke/TIA) ?',
  'Long Covid'),
 ('Patient pregnant?', 'Long Covid'),
 ('Please specify drugs used. (choice=Amphetamines)', 'Long Covid'),
 ('Please specify drugs used. (choice=Cocaine)', 'Long Covid'),
 ('Please specify drugs used. (choice=Opiods)', 'Long Covid'),
 ('Please specify drugs used. (choice=Other)', 'Long Covid'),
 ('Prior myocardial infarction ?', 'Long Covid'),
 ('Prior stroke ? ', 'Long Covid'),
 ('Prior transient ischemic attack (TIA) ?', 'Long Covid'),
 ('Psychiatric disease?', 'Long Covid'),
 ('Pulmonary hypertension ?', 'Long Covid'),
 ('Red eye (Conjunctivitis) ?', 'Long Covid'),
 ('Rheumatologic disease ?', 'Long Covid'),
 ('Runny nose (Rhinorrhea) ?', 'Long Covid'),
 ('Seizure ?', 'Long Covid'),
 ('Sex at birth:', 'Long Covid'),
 ('Shortness of breath (Dyspnea) ?', 'Long Covid'),
 ('Skin rash ?', 'Long Covid'),
 ('Smoking status:', 'Long Covid'),
 ('Sore throat ?', 'Long Covid'),
 ('Trouble speaking (Aphasia / Dysphasia) ?', 'Long Covid')]