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

fix: filter out crazy trials [DET-4782] #1795

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -45,7 +45,8 @@ interface TrialHParams {

const DEFAULT_MAX_TRIALS = 100;
const MAX_DATAPOINTS = 5000;
const TOP_TRIALS_OPTIONS = [ 1, 10, 20, 50, 100, 200, 500 ];
const MAX_ALLOWED_METRIC_VALUE = 100000;
const TOP_TRIALS_OPTIONS = [ 1, 10, 20, 50, 100 ];

const LearningCurve: React.FC<Props> = ({
experiment,
Expand Down Expand Up @@ -174,6 +175,7 @@ const LearningCurve: React.FC<Props> = ({
const trialHpMap: Record<number, TrialHParams> = {};
const batchesMap: Record<number, number> = {};
const metricsMap: Record<number, Record<number, number>> = {};
const filterTrialMap: Record<number, boolean> = {};

consumeStream<V1TrialsSampleResponse>(
detApi.StreamingInternal.determinedTrialsSample(
Expand All @@ -198,8 +200,6 @@ const LearningCurve: React.FC<Props> = ({

(event.promotedTrials || []).forEach(trialId => trialIdsMap[trialId] = trialId);
(event.demotedTrials || []).forEach(trialId => delete trialIdsMap[trialId]);
const newTrialIds = Object.values(trialIdsMap);
setTrialIds(newTrialIds);

(event.trials || []).forEach(trial => {
const id = trial.trialId;
Expand All @@ -216,11 +216,13 @@ const LearningCurve: React.FC<Props> = ({

trialDataMap[id] = trialDataMap[id] || [];
metricsMap[id] = metricsMap[id] || {};
filterTrialMap[id] = filterTrialMap[id] || false;

trial.data.forEach(datapoint => {
batchesMap[datapoint.batches] = datapoint.batches;
metricsMap[id][datapoint.batches] = datapoint.value;
trialHpMap[id].metric = datapoint.value;
if (datapoint.value > MAX_ALLOWED_METRIC_VALUE) filterTrialMap[id] = true;
});
});

Expand All @@ -233,6 +235,9 @@ const LearningCurve: React.FC<Props> = ({
const newBatches = Object.values(batchesMap);
setBatches(newBatches);

const newTrialIds = Object.values(trialIdsMap).filter(trialId => !filterTrialMap[trialId]);
setTrialIds(newTrialIds);

const newChartData = newTrialIds.map(trialId => newBatches.map(batch => {
const value = metricsMap[trialId][batch];
return value != null ? value : null;
Expand Down