Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include a cold start bandit test case #71

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flag in the UFC so that we can request an assignment from the cold-started bandit

"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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the v to mirror the production change we're making. It doesn't make a material difference as long as this is consistent with bandit-models-v1.json

},
"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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test case! We check all three variations

"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"}
}
]
}
Loading