Skip to content

Commit

Permalink
Include a cold start bandit test case (#71)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
aarsilv authored Nov 7, 2024
1 parent 2191111 commit 5e5a736
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 8 deletions.
29 changes: 27 additions & 2 deletions ufc/bandit-flags-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,31 @@
}
],
"totalShards": 10000
},
"cold_start_bandit_flag": {
"key": "cold_start_bandit_flag",
"enabled": true,
"variationType": "STRING",
"variations": {
"cold_start_bandit": {
"key": "cold_start_bandit",
"value": "cold_start_bandit"
}
},
"allocations": [
{
"key": "all-traffic",
"rules": [],
"splits": [
{
"variationKey": "cold_start_bandit",
"shards": []
}
],
"doLog": true
}
],
"totalShards": 10000
}
},
"bandits": {
Expand Down Expand Up @@ -286,7 +311,7 @@
"variationValue": "banner_bandit"
}
],
"modelVersion": "v123"
"modelVersion": "123"
},
"car_bandit": {
"flagVariations": [
Expand All @@ -298,7 +323,7 @@
"variationValue": "car_bandit"
}
],
"modelVersion": "v456"
"modelVersion": "456"
},
"cold_start_bandit": {
"flagVariations": [
Expand Down
12 changes: 6 additions & 6 deletions ufc/bandit-models-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"banditKey": "banner_bandit",
"modelName": "falcon",
"updatedAt": "2023-09-13T04:52:06.462Z",
"modelVersion": "v123",
"modelVersion": "123",
"modelData": {
"gamma": 1.0,
"defaultActionScore": 0.0,
Expand All @@ -28,9 +28,9 @@
{
"attributeKey": "loyalty_tier",
"valueCoefficients": {
"gold": 4.5,
"silver": 3.2,
"bronze": 1.9
"gold": 4.5,
"silver": 3.2,
"bronze": 1.9
},
"missingValueCoefficient": 0.0
},
Expand Down Expand Up @@ -110,7 +110,7 @@
"banditKey": "car_bandit",
"modelName": "falcon",
"updatedAt": "2023-09-13T04:52:06.462Z",
"modelVersion": "v456",
"modelVersion": "456",
"modelData": {
"gamma": 1.0,
"defaultActionScore": 5.0,
Expand Down Expand Up @@ -143,5 +143,5 @@
"coefficients": {}
}
}
}
}
}
81 changes: 81 additions & 0 deletions ufc/bandit-tests/test-case-bandit-cold-start.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"flag": "cold_start_bandit_flag",
"defaultValue": "default",
"subjects": [
{
"subjectKey": "alice",
"subjectAttributes": {
"numericAttributes": {},
"categoricalAttributes": {}
},
"actions": [
{
"actionKey": "red",
"numericAttributes": {},
"categoricalAttributes": {}
},
{
"actionKey": "blue",
"numericAttributes": {},
"categoricalAttributes": {}
},
{
"actionKey": "green",
"numericAttributes": {},
"categoricalAttributes": {}
}
],
"assignment": {"variation": "cold_start_bandit", "action": "red"}
},
{
"subjectKey": "bob",
"subjectAttributes": {
"numericAttributes": {},
"categoricalAttributes": {}
},
"actions": [
{
"actionKey": "red",
"numericAttributes": {},
"categoricalAttributes": {}
},
{
"actionKey": "blue",
"numericAttributes": {},
"categoricalAttributes": {}
},
{
"actionKey": "green",
"numericAttributes": {},
"categoricalAttributes": {}
}
],
"assignment": {"variation": "cold_start_bandit", "action": "green"}
},
{
"subjectKey": "charles",
"subjectAttributes": {
"numericAttributes": {},
"categoricalAttributes": {}
},
"actions": [
{
"actionKey": "red",
"numericAttributes": {},
"categoricalAttributes": {}
},
{
"actionKey": "blue",
"numericAttributes": {},
"categoricalAttributes": {}
},
{
"actionKey": "green",
"numericAttributes": {},
"categoricalAttributes": {}
}
],
"assignment": {"variation": "cold_start_bandit", "action": "blue"}
}
]
}

0 comments on commit 5e5a736

Please sign in to comment.