Skip to content

Commit 79b019e

Browse files
authored
Filter custom plot creation options (#3526)
1 parent 5c5cb42 commit 79b019e

File tree

5 files changed

+425
-205
lines changed

5 files changed

+425
-205
lines changed

extension/src/plots/model/custom.test.ts

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,7 @@
1-
import {
2-
CHECKPOINTS_PARAM,
3-
cleanupOldOrderValue,
4-
doesCustomPlotAlreadyExist
5-
} from './custom'
1+
import { cleanupOldOrderValue } from './custom'
62
import { CustomPlotType } from '../webview/contract'
73
import { FILE_SEPARATOR } from '../../experiments/columns/paths'
84

9-
describe('doesCustomPlotAlreadyExist', () => {
10-
it('should return true if plot exists', () => {
11-
const output = doesCustomPlotAlreadyExist(
12-
[
13-
{
14-
metric: 'summary.json:loss',
15-
param: 'params.yaml:dropout',
16-
type: CustomPlotType.METRIC_VS_PARAM
17-
},
18-
{
19-
metric: 'summary.json:accuracy',
20-
param: 'params.yaml:epochs',
21-
type: CustomPlotType.METRIC_VS_PARAM
22-
},
23-
{
24-
metric: 'summary.json:loss',
25-
param: CHECKPOINTS_PARAM,
26-
type: CustomPlotType.CHECKPOINT
27-
}
28-
],
29-
'summary.json:accuracy',
30-
'params.yaml:epochs'
31-
)
32-
expect(output).toStrictEqual(true)
33-
})
34-
35-
it('should return false if plot does not exists', () => {
36-
const output = doesCustomPlotAlreadyExist(
37-
[
38-
{
39-
metric: 'summary.json:loss',
40-
param: 'params.yaml:dropout',
41-
type: CustomPlotType.METRIC_VS_PARAM
42-
},
43-
{
44-
metric: 'summary.json:accuracy',
45-
param: 'params.yaml:epochs',
46-
type: CustomPlotType.METRIC_VS_PARAM
47-
},
48-
{
49-
metric: 'summary.json:loss',
50-
param: CHECKPOINTS_PARAM,
51-
type: CustomPlotType.CHECKPOINT
52-
}
53-
],
54-
'summary.json:loss',
55-
'params.yaml:epochs'
56-
)
57-
expect(output).toStrictEqual(false)
58-
})
59-
})
60-
615
describe('cleanupOlderValue', () => {
626
it('should update value if contents are outdated', () => {
637
const output = cleanupOldOrderValue(

extension/src/plots/model/custom.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ export const isCheckpointValue = (
1616
export const isCheckpointPlot = (plot: CustomPlot): plot is CheckpointPlot =>
1717
plot.type === CustomPlotType.CHECKPOINT
1818

19-
export const doesCustomPlotAlreadyExist = (
20-
order: CustomPlotsOrderValue[],
21-
metric: string,
22-
param = CHECKPOINTS_PARAM
23-
) =>
24-
order.some(value => {
25-
return value.param === param && value.metric === metric
26-
})
27-
2819
export const removeColumnTypeFromPath = (
2920
columnPath: string,
3021
type: string,

0 commit comments

Comments
 (0)