Medial Code Documentation
Loading...
Searching...
No Matches
MedDescribe.h
1#pragma once
2
3//
4// MedDescribe
5//
6// Contains tools to study the followings:
7// (1) Distributions of signals.
8// (2) Biases of signals.
9// (3) Joint distribution of signals.
10// (4) Joint distributions of outcomes, and signals vs. outcomes.
11//
12
13#include <string>
14#include <map>
15#include <vector>
16#include <InfraMed/InfraMed/InfraMed.h>
17#include <MedUtils/MedUtils/MedUtils.h>
19
20using namespace std;
21
23
24public:
25 vector<float> quantiles = { (float)0.01, (float)0.1, (float)0.25, (float)0.5, (float)0.75, (float)0.9, (float)0.99 };
26 float min_val = (float)-1e6;
27 float max_val = (float)1e6;
28 vector<float> quantiles_vals;
29 float mean;
30 float std;
31 float median;
32 int N;
33 int N_pos, N_neg;
34 int N0;
35 int N_diff_vals;
36 int N_out_of_range;
37 float vmin, vmax;
38
39 int get_for_vec(vector<float> &v);
40 int safe_get_for_vec(vector<float> v) { return get_for_vec(v); }
41 void print(const string prefix);
42};
43
44
46
47public:
48 // signal names
49 string sig1;
50 string sig2;
51
52 vector<int> pids_to_check;
53 MedMutualDist() {};
54 ~MedMutualDist() {};
55
56 // universal sigs
57 int sig1_time_ch = 0;
58 int sig1_val_ch = 0;
59 int sig2_time_ch = 0;
60 int sig2_val_ch = 0;
61
62 // binning
63 int sig1_is_categorial = 0;
64 int auto_range = 1;
65 float min_val1 = (float)-1e10, max_val1 = (float)1e10;
66 float min_val2 = (float)-1e10, max_val2 = (float)1e10;
67 float bin_size = (float)0.1;
68
69 // general restrictions
70 int min_time = 0;
71 int max_time = 1999999999;
72 int gender_mask = 0x3;
73
74 // sampling params
75 int jump1_time = 180; // minimal jump between sig1 samples, one random sample will be taken in each bucket.
76 int win_from = 60, win_to = -60; // window around sampling point to search for sig2
77 int win_time_unit = MedTime::Days;
78
79 // collected values
80 map<float, vector<float>> values;
81
82 // functions
83
84 // init_from_string :: implemented in SerializableObject
85 int init(map<string, string>& mapper);
86 int collect_values(MedRepository &rep);
87 int collect_values(const string &rep_fname);
88
89};
An Abstract class that can be serialized and written/read from file.
Definition MedDescribe.h:45
int init(map< string, string > &mapper)
Virtual to init object from parsed fields.
Definition MedDescribe.cpp:9
Definition InfraMed.h:303
static const int Days
days since 1900/01/01
Definition MedTime.h:28
Definition SerializableObject.h:32
Definition MedDescribe.h:22
Definition StdDeque.h:58