-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsleep_hmm.proto
120 lines (91 loc) · 3.13 KB
/
sleep_hmm.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
option java_package = "com.hello.suripu.api.datascience";
option java_outer_classname = "SleepHmmProtos";
/* Descriptions of the sleep states (by index) */
enum SleepMode {
SLEEP = 0;
WAKE = 1;
CONDITIONAL_SLEEP = 2; //if there is SLEEP before and after, this state becomes SLEEP
}
enum BedMode {
ON_BED = 0;
OFF_BED = 1;
CONDITIONAL_BED = 2; //if there is ON_BED before and after, this state becomes ON_BED
}
enum SleepDepth {
NOT_APPLICABLE = 0;
LIGHT = 1; //just before wakeup (lights are on, but you're still sleeping)
REGULAR = 2; //"normal" sleep
DISTURBED = 3;//tossing turning, or probably just not sleeping
}
/* Observational model types */
/* Poisson discrete distriubtion
http://en.wikipedia.org/wiki/Poisson_distribution
valid on range [0,1,2...inf]
*/
message PoissonModel {
required double mean = 1;
optional double weight = 2;
}
/* Alphabet model symbol P(A) = 0.3, P(B) = 0.7, etc.
as a vector... so P(i=0) = 0.3, P(i=1) = 0.7, etc.
*/
message DiscreteAlphabetModel {
repeated double probabilities = 1;
optional double weight = 2;
}
/* Gamma distribution
http://en.wikipedia.org/wiki/Gamma_distribution
valid on range = [0,inf]
My parameters are different from that of the wiki's
here's the conversion:
variance = stddev^2
theta = variance / mean
k = mean / theta
or alpha = k
beta = 1/theta
*/
message GammaModel {
required double mean = 1;
required double stddev = 2;
optional double weight = 3;
}
/* Description of each state */
message StateModel {
//deprecated
// optional PoissonModel light = 1;
// optional PoissonModel motion_count = 2;
// optional DiscreteAlphabetModel waves = 3;
optional SleepMode sleep_mode = 4;
optional BedMode bed_mode = 5;
optional SleepDepth sleep_depth = 6;
optional GammaModel light = 11;
optional PoissonModel motion_count = 12;
optional DiscreteAlphabetModel disturbances = 13;
optional GammaModel log_sound_count = 14;
optional DiscreteAlphabetModel natural_light_filter = 15;
optional PoissonModel partner_motion_count = 16;
optional DiscreteAlphabetModel partner_disturbances = 17;
}
message SleepHmm {
optional string user_id = 1;
optional string source = 2;
repeated StateModel states = 3;
optional int32 num_states = 4;
repeated double state_transition_matrix = 5;
repeated double initial_state_probabilities = 6;
optional double audio_disturbance_threshold_db = 7;
optional double pill_magnitude_disturbance_threshold_lsb = 8;
optional double natural_light_filter_start_hour = 9; //in 24 hours format, so 16.0 is 4pm
optional double natural_light_filter_stop_hour = 10; //in 24 hours format, so 4.0 is 4am
optional int32 num_model_params = 11;//for computing BIC/AIC
optional string model_name = 12;
optional int32 num_minutes_in_meas_period = 13;
optional bool enable_interval_search = 14;
optional double light_pre_multiplier = 15;
optional double light_floor_lux = 16;
optional bool use_wave_as_disturbance = 17;
optional double audio_level_above_background_threshold_db = 18;
}
message SleepHmmModelSet {
repeated SleepHmm models = 1;
}