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

Filter custom plot creation options #3526

Merged
merged 5 commits into from
Mar 22, 2023
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
58 changes: 1 addition & 57 deletions extension/src/plots/model/custom.test.ts
Original file line number Diff line number Diff line change
@@ -1,63 +1,7 @@
import {
CHECKPOINTS_PARAM,
cleanupOldOrderValue,
doesCustomPlotAlreadyExist
} from './custom'
import { cleanupOldOrderValue } from './custom'
import { CustomPlotType } from '../webview/contract'
import { FILE_SEPARATOR } from '../../experiments/columns/paths'

describe('doesCustomPlotAlreadyExist', () => {
it('should return true if plot exists', () => {
const output = doesCustomPlotAlreadyExist(
[
{
metric: 'summary.json:loss',
param: 'params.yaml:dropout',
type: CustomPlotType.METRIC_VS_PARAM
},
{
metric: 'summary.json:accuracy',
param: 'params.yaml:epochs',
type: CustomPlotType.METRIC_VS_PARAM
},
{
metric: 'summary.json:loss',
param: CHECKPOINTS_PARAM,
type: CustomPlotType.CHECKPOINT
}
],
'summary.json:accuracy',
'params.yaml:epochs'
)
expect(output).toStrictEqual(true)
})

it('should return false if plot does not exists', () => {
const output = doesCustomPlotAlreadyExist(
[
{
metric: 'summary.json:loss',
param: 'params.yaml:dropout',
type: CustomPlotType.METRIC_VS_PARAM
},
{
metric: 'summary.json:accuracy',
param: 'params.yaml:epochs',
type: CustomPlotType.METRIC_VS_PARAM
},
{
metric: 'summary.json:loss',
param: CHECKPOINTS_PARAM,
type: CustomPlotType.CHECKPOINT
}
],
'summary.json:loss',
'params.yaml:epochs'
)
expect(output).toStrictEqual(false)
})
})

describe('cleanupOlderValue', () => {
it('should update value if contents are outdated', () => {
const output = cleanupOldOrderValue(
Expand Down
9 changes: 0 additions & 9 deletions extension/src/plots/model/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ export const isCheckpointValue = (
export const isCheckpointPlot = (plot: CustomPlot): plot is CheckpointPlot =>
plot.type === CustomPlotType.CHECKPOINT

export const doesCustomPlotAlreadyExist = (
order: CustomPlotsOrderValue[],
metric: string,
param = CHECKPOINTS_PARAM
) =>
order.some(value => {
return value.param === param && value.metric === metric
})

export const removeColumnTypeFromPath = (
columnPath: string,
type: string,
Expand Down
Loading