-
Notifications
You must be signed in to change notification settings - Fork 3
/
proto.atd
151 lines (115 loc) · 3.44 KB
/
proto.atd
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
(** types for the protocol between the master and worker, and among
workers. There is at most one worker per host, serving on a
pre-determined port (as a means of achieving uniqueness) *)
type worker_id = string
type task_id = string
type host = string
type feature_id = int
type id = {
worker_id : worker_id ;
user : string ; (* name of user owning the worker process *)
}
type known_worker = (worker_id * host list)
(* a worker peer may be accessible via multiple ip addresses (eg
when a host has more than one network interface) *)
type known_workers = known_worker list
(* feature metadata *)
type t <ocaml_biniou module="Dog_b" ocaml_json module="Dog_j">= abstract
type loss_type = [ Logistic | Square ]
type config = {
task_id : task_id;
loss_type : loss_type;
dog_t : t;
dog_file_size : int;
y_feature : (feature_id * string);
fold_feature_opt : (feature_id * string) option;
random_seed : int list <ocaml repr="array">;
num_folds : int;
}
(*
type ufeature <ocaml_biniou module="Dog_b" ocaml_json module="Dog_j">= abstract
type ifeature <ocaml_biniou module="Dog_b" ocaml_json module="Dog_j">= abstract
*)
type point = {
(* what is the value of the piecewise function at the split? *)
s_gamma : float ;
(* how many observations does the split cover? *)
s_n : int ;
(* what is the loss? *)
s_loss : float ;
}
type ordinal_split = {
os_feature_id : feature_id ;
os_split : int ;
os_left : point ;
os_right : point ;
}
type categorical_split = (ordinal_split * int list <ocaml repr="array">)
type split = [
| OrdinalSplit of ordinal_split
| CategoricalSplit of categorical_split
]
type loss_split_opt = (float * split) option
type push = {
feature_id : feature_id ;
split : split
}
type to_worker_in_acquired = [
| Configure of config
]
type to_worker_in_learning_or_configured = [
| GetFeaturesFromPeers of feature_id list
(* instruct the worker to acquire these features from any of its
collaborating peers, if it doesn't already have them; it is not
guaranteed that a collaborating peer has that feature. *)
| GetFeatures of feature_id list
(* get feature _data_ (rather than metadata), from _this_ worker
(rather than its peers) *)
| AddFeatures of (feature_id list * [BestAndPartition | PartitionOnly])
(* add a feature to the set used for finding a best split, or used
for partitioning of the observations; a feature may
simultaneously serve as both *)
]
type learn = {
fold : int ;
learning_rate : float
}
type to_worker_in_configured = [
| Learn of learn
]
type to_worker_in_learning = [
| Sample
| BestSplit
(* get the best split among all the worker's active features *)
| Push of push
| Ascend
| Descend of [Left | Right]
| CopyFeatures of (feature_id * string) list
]
type to_worker = [
| Id
(* what is the worker id? *)
| InformPeerHosts of host list
(* tell the worker of one its peers; it may or may not collaborate
on the worker's task *)
| Acquire of task_id
(* client tries to assert his ownership of worker *)
| Acquired of (task_id * to_worker_in_acquired)
| Configured of (task_id * to_worker_in_configured)
| Learning of (task_id * to_worker_in_learning)
]
type from_worker = [
| Error of string
| AckId of id
| AckBestSplit of loss_split_opt
| AckSample
| AckAcquire of bool
| AckConfigure
| AckSetRandomSeed
| AckAddFeatures
| AckPush
| AckAscend
| AckDescend
| AckCopyFeatures
| AckLearn
]