Skip to content

Commit 5e5a736

Browse files
authored
Include a cold start bandit test case (#71)
* cold start bandit test case * hit all variations in the cold start test * correct flag key * try null instead of cold start for model version * revert to using cold start placeholder
1 parent 2191111 commit 5e5a736

File tree

3 files changed

+114
-8
lines changed

3 files changed

+114
-8
lines changed

ufc/bandit-flags-v1.json

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,31 @@
227227
}
228228
],
229229
"totalShards": 10000
230+
},
231+
"cold_start_bandit_flag": {
232+
"key": "cold_start_bandit_flag",
233+
"enabled": true,
234+
"variationType": "STRING",
235+
"variations": {
236+
"cold_start_bandit": {
237+
"key": "cold_start_bandit",
238+
"value": "cold_start_bandit"
239+
}
240+
},
241+
"allocations": [
242+
{
243+
"key": "all-traffic",
244+
"rules": [],
245+
"splits": [
246+
{
247+
"variationKey": "cold_start_bandit",
248+
"shards": []
249+
}
250+
],
251+
"doLog": true
252+
}
253+
],
254+
"totalShards": 10000
230255
}
231256
},
232257
"bandits": {
@@ -286,7 +311,7 @@
286311
"variationValue": "banner_bandit"
287312
}
288313
],
289-
"modelVersion": "v123"
314+
"modelVersion": "123"
290315
},
291316
"car_bandit": {
292317
"flagVariations": [
@@ -298,7 +323,7 @@
298323
"variationValue": "car_bandit"
299324
}
300325
],
301-
"modelVersion": "v456"
326+
"modelVersion": "456"
302327
},
303328
"cold_start_bandit": {
304329
"flagVariations": [

ufc/bandit-models-v1.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"banditKey": "banner_bandit",
99
"modelName": "falcon",
1010
"updatedAt": "2023-09-13T04:52:06.462Z",
11-
"modelVersion": "v123",
11+
"modelVersion": "123",
1212
"modelData": {
1313
"gamma": 1.0,
1414
"defaultActionScore": 0.0,
@@ -28,9 +28,9 @@
2828
{
2929
"attributeKey": "loyalty_tier",
3030
"valueCoefficients": {
31-
"gold": 4.5,
32-
"silver": 3.2,
33-
"bronze": 1.9
31+
"gold": 4.5,
32+
"silver": 3.2,
33+
"bronze": 1.9
3434
},
3535
"missingValueCoefficient": 0.0
3636
},
@@ -110,7 +110,7 @@
110110
"banditKey": "car_bandit",
111111
"modelName": "falcon",
112112
"updatedAt": "2023-09-13T04:52:06.462Z",
113-
"modelVersion": "v456",
113+
"modelVersion": "456",
114114
"modelData": {
115115
"gamma": 1.0,
116116
"defaultActionScore": 5.0,
@@ -143,5 +143,5 @@
143143
"coefficients": {}
144144
}
145145
}
146-
}
146+
}
147147
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"flag": "cold_start_bandit_flag",
3+
"defaultValue": "default",
4+
"subjects": [
5+
{
6+
"subjectKey": "alice",
7+
"subjectAttributes": {
8+
"numericAttributes": {},
9+
"categoricalAttributes": {}
10+
},
11+
"actions": [
12+
{
13+
"actionKey": "red",
14+
"numericAttributes": {},
15+
"categoricalAttributes": {}
16+
},
17+
{
18+
"actionKey": "blue",
19+
"numericAttributes": {},
20+
"categoricalAttributes": {}
21+
},
22+
{
23+
"actionKey": "green",
24+
"numericAttributes": {},
25+
"categoricalAttributes": {}
26+
}
27+
],
28+
"assignment": {"variation": "cold_start_bandit", "action": "red"}
29+
},
30+
{
31+
"subjectKey": "bob",
32+
"subjectAttributes": {
33+
"numericAttributes": {},
34+
"categoricalAttributes": {}
35+
},
36+
"actions": [
37+
{
38+
"actionKey": "red",
39+
"numericAttributes": {},
40+
"categoricalAttributes": {}
41+
},
42+
{
43+
"actionKey": "blue",
44+
"numericAttributes": {},
45+
"categoricalAttributes": {}
46+
},
47+
{
48+
"actionKey": "green",
49+
"numericAttributes": {},
50+
"categoricalAttributes": {}
51+
}
52+
],
53+
"assignment": {"variation": "cold_start_bandit", "action": "green"}
54+
},
55+
{
56+
"subjectKey": "charles",
57+
"subjectAttributes": {
58+
"numericAttributes": {},
59+
"categoricalAttributes": {}
60+
},
61+
"actions": [
62+
{
63+
"actionKey": "red",
64+
"numericAttributes": {},
65+
"categoricalAttributes": {}
66+
},
67+
{
68+
"actionKey": "blue",
69+
"numericAttributes": {},
70+
"categoricalAttributes": {}
71+
},
72+
{
73+
"actionKey": "green",
74+
"numericAttributes": {},
75+
"categoricalAttributes": {}
76+
}
77+
],
78+
"assignment": {"variation": "cold_start_bandit", "action": "blue"}
79+
}
80+
]
81+
}

0 commit comments

Comments
 (0)