Skip to content

Commit 90dabbc

Browse files
authored
Tie break top-scoring bandit actions by action name (#119)
* tie break top-scoring actions by action name * bump version number
1 parent ae6bfde commit 90dabbc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eppo/js-client-sdk-common",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "Eppo SDK for client-side JavaScript applications (base for both web and react native)",
55
"main": "dist/index.js",
66
"files": [

src/bandit-evaluator.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ export class BanditEvaluator {
144144
let currTopScore: number | null = null;
145145
let currTopAction: string | null = null;
146146
actionScoreEntries.forEach(([actionKey, actionScore]) => {
147-
if (currTopScore === null || actionScore > currTopScore) {
147+
if (
148+
currTopScore === null ||
149+
currTopAction === null ||
150+
actionScore > currTopScore ||
151+
(actionScore === currTopScore && actionKey < currTopAction)
152+
) {
148153
currTopScore = actionScore;
149154
currTopAction = actionKey;
150155
}

0 commit comments

Comments
 (0)