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

Add Roulette to RRCP Experiment Methodologies #657

Merged
merged 6 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions app/models/Methodology.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ case class EpsilonGreedyBandit(
testName: Option[String] = None
) extends Methodology

case class Roulette(
name: String = "Roulette",
testName: Option[String] = None
) extends Methodology

case object Methodology {
val defaultMethodologies = List(ABTest())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import AddIcon from '@mui/icons-material/Add';
import Alert from '@mui/lab/Alert';
import { addMethodologyToTestName } from './helpers/methodology';

const isBandit = (methodology: Methodology): boolean => methodology.name === 'EpsilonGreedyBandit';
const isBandit = (methodology: Methodology): boolean =>
methodology.name === 'EpsilonGreedyBandit' || methodology.name === 'Roulette';

const useStyles = makeStyles(({ spacing, palette }: Theme) => ({
container: {
Expand Down Expand Up @@ -89,6 +90,8 @@ const TestMethodology: React.FC<TestMethodologyProps> = ({
const value = event.target.value as Methodology['name'];
if (value === 'EpsilonGreedyBandit') {
onChange(defaultEpsilonGreedyBandit);
} else if (value === 'Roulette') {
onChange({ name: 'Roulette' });
} else {
onChange({ name: 'ABTest' });
}
Expand All @@ -107,6 +110,9 @@ const TestMethodology: React.FC<TestMethodologyProps> = ({
<MenuItem value={'EpsilonGreedyBandit'} key={'EpsilonGreedyBandit'}>
Epsilon-greedy bandit
</MenuItem>
<MenuItem value={'Roulette'} key={'Roulette'}>
Roulette
</MenuItem>
</Select>
</div>
{methodology.name === 'EpsilonGreedyBandit' && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const addMethodologyToTestName = (testName: string, methodology: Methodol
const suffix = secondPart ? `__${secondPart}` : '';
if (methodology.name === 'EpsilonGreedyBandit') {
return `${firstPart}_EpsilonGreedyBandit-${methodology.epsilon}${suffix}`;
} else if (methodology.name === 'Roulette') {
return `${firstPart}_Roulette${suffix}`;
} else {
return `${firstPart}_ABTest${suffix}`;
}
Expand Down
4 changes: 4 additions & 0 deletions public/src/components/channelManagement/helpers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ interface EpsilonGreedyBanditMethodology {
name: 'EpsilonGreedyBandit';
epsilon: number;
}
interface RouletteMethodology {
name: 'Roulette';
}
// each methodology may have an optional testName, which should be used for tracking
export type Methodology = { testName?: string } & (
| ABTestMethodology
| EpsilonGreedyBanditMethodology
| RouletteMethodology
);

export interface Test {
Expand Down
4 changes: 3 additions & 1 deletion public/src/components/channelManagement/testListTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ const TestListTest: React.FC<TestListTestProps> = ({
const classes = useStyles();

const hasArticleCount = test.articlesViewedSettings !== undefined;
const isBanditTest = test.methodologies.find(method => method.name === 'EpsilonGreedyBandit');
const isBanditTest = test.methodologies.find(
method => method.name === 'EpsilonGreedyBandit' || method.name === 'Roulette',
);

const [ref, isHovered] = useHover<HTMLDivElement>();

Expand Down
Loading