Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.editor
Commits
215d7623
Commit
215d7623
authored
6 years ago
by
Jaden DIEFENBAUGH
Browse files
Options
Downloads
Patches
Plain Diff
[js][exp] choosing a protocol now smartly maps datasets based on names, fixes
#126
parent
40fbf9c6
No related branches found
No related tags found
No related merge requests found
Pipeline
#24333
passed
6 years ago
Stage: build
Stage: browser-tests
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
conda/js/src/components/experiment/ExperimentEditor.jsx
+16
-2
16 additions, 2 deletions
conda/js/src/components/experiment/ExperimentEditor.jsx
conda/js/src/components/experiment/ExperimentEditor.spec.jsx
+5
-5
5 additions, 5 deletions
conda/js/src/components/experiment/ExperimentEditor.spec.jsx
with
21 additions
and
7 deletions
conda/js/src/components/experiment/ExperimentEditor.jsx
+
16
−
2
View file @
215d7623
...
@@ -200,6 +200,9 @@ const levMapStrings = (keyArr: string[], valArr: string[]): { [string]: string }
...
@@ -200,6 +200,9 @@ const levMapStrings = (keyArr: string[], valArr: string[]): { [string]: string }
const
vals
=
[...
valArr
];
const
vals
=
[...
valArr
];
const
map
=
{};
const
map
=
{};
//console.log(keys);
//console.log(vals);
while
(
keys
.
length
>
0
){
while
(
keys
.
length
>
0
){
const
scores
=
{};
const
scores
=
{};
const
matches
=
{};
const
matches
=
{};
...
@@ -227,6 +230,7 @@ const levMapStrings = (keyArr: string[], valArr: string[]): { [string]: string }
...
@@ -227,6 +230,7 @@ const levMapStrings = (keyArr: string[], valArr: string[]): { [string]: string }
map
[
chosenKey
]
=
matches
[
chosenKey
];
map
[
chosenKey
]
=
matches
[
chosenKey
];
keys
.
splice
(
keys
.
indexOf
(
chosenKey
),
1
);
keys
.
splice
(
keys
.
indexOf
(
chosenKey
),
1
);
vals
.
splice
(
vals
.
indexOf
(
matches
[
chosenKey
]),
1
);
vals
.
splice
(
vals
.
indexOf
(
matches
[
chosenKey
]),
1
);
//console.log(map);
}
}
const
orderedMap
=
{};
const
orderedMap
=
{};
...
@@ -234,6 +238,7 @@ const levMapStrings = (keyArr: string[], valArr: string[]): { [string]: string }
...
@@ -234,6 +238,7 @@ const levMapStrings = (keyArr: string[], valArr: string[]): { [string]: string }
orderedMap
[
k
]
=
map
[
k
];
orderedMap
[
k
]
=
map
[
k
];
}
}
//console.log(orderedMap);
return
orderedMap
;
return
orderedMap
;
};
};
...
@@ -587,7 +592,6 @@ export class ExperimentEditor extends React.Component<Props, State> {
...
@@ -587,7 +592,6 @@ export class ExperimentEditor extends React.Component<Props, State> {
onChange
=
{
e
=>
{
onChange
=
{
e
=>
{
const
str
=
e
.
target
.
value
;
const
str
=
e
.
target
.
value
;
//Object.keys(this.props.data.contents.datasets).map(dsName
const
newDs
=
JSON
.
parse
(
str
);
const
newDs
=
JSON
.
parse
(
str
);
//console.log(newDs);
//console.log(newDs);
this
.
setContents
({...
this
.
props
.
data
.
contents
,
datasets
:
newDs
});
this
.
setContents
({...
this
.
props
.
data
.
contents
,
datasets
:
newDs
});
...
@@ -628,7 +632,17 @@ export class ExperimentEditor extends React.Component<Props, State> {
...
@@ -628,7 +632,17 @@ export class ExperimentEditor extends React.Component<Props, State> {
const
tcDs
=
tcDss
.
pop
();
const
tcDs
=
tcDss
.
pop
();
let
setsIdx
=
sets
.
findIndex
(
set
=>
set
.
set
===
tcDs
.
name
&&
dbSetIsValidForTcDataset
(
set
,
tcDs
));
let
setsIdx
=
sets
.
findIndex
(
set
=>
set
.
set
===
tcDs
.
name
&&
dbSetIsValidForTcDataset
(
set
,
tcDs
));
if
(
setsIdx
===
-
1
){
if
(
setsIdx
===
-
1
){
setsIdx
=
sets
.
findIndex
(
set
=>
dbSetIsValidForTcDataset
(
set
,
tcDs
));
const
validSets
=
sets
.
filter
(
set
=>
dbSetIsValidForTcDataset
(
set
,
tcDs
));
let
bestScore
=
10000
;
let
bestMatch
=
'
notfound
'
;
for
(
const
s
of
validSets
){
const
score
=
lev
.
get
(
tcDs
.
name
,
s
.
set
);
if
(
score
<
bestScore
){
bestScore
=
score
;
bestMatch
=
s
;
}
}
setsIdx
=
sets
.
findIndex
(
set
=>
set
==
bestMatch
);
}
}
if
(
setsIdx
===
-
1
)
if
(
setsIdx
===
-
1
)
return
[
dbProtStr
,
false
];
return
[
dbProtStr
,
false
];
...
...
This diff is collapsed.
Click to expand it.
conda/js/src/components/experiment/ExperimentEditor.spec.jsx
+
5
−
5
View file @
215d7623
...
@@ -239,18 +239,18 @@ describe('<ExperimentEditor />', () => {
...
@@ -239,18 +239,18 @@ describe('<ExperimentEditor />', () => {
//console.log('doing dataset');
//console.log('doing dataset');
wrapper
.
find
(
'
svg #block_training_data
'
).
simulate
(
'
click
'
);
wrapper
.
find
(
'
svg #block_training_data
'
).
simulate
(
'
click
'
);
wrapper
.
find
(
'
div.datasets select
'
).
at
(
0
).
simulate
(
'
change
'
,
{
target
:
{
value
:
'
{"testing_data":{"database":"iris/1","protocol":"Main","set":"t
rain
ing"},"training_data":{"database":"iris/1","protocol":"Main","set":"t
est
ing"}}
'
}});
wrapper
.
find
(
'
div.datasets select
'
).
at
(
0
).
simulate
(
'
change
'
,
{
target
:
{
value
:
'
{"testing_data":{"database":"iris/1","protocol":"Main","set":"t
est
ing"},"training_data":{"database":"iris/1","protocol":"Main","set":"t
rain
ing"}}
'
}});
expect
(
updateFunc
.
callCount
).
to
.
equal
(
1
);
expect
(
updateFunc
.
callCount
).
to
.
equal
(
1
);
expect
(
wrapper
.
props
().
data
.
contents
).
to
.
have
.
deep
.
property
(
'
datasets
'
,
{
expect
(
wrapper
.
props
().
data
.
contents
).
to
.
have
.
deep
.
property
(
'
datasets
'
,
{
'
testing_data
'
:
{
'
testing_data
'
:
{
'
database
'
:
'
iris/1
'
,
'
database
'
:
'
iris/1
'
,
'
protocol
'
:
'
Main
'
,
'
protocol
'
:
'
Main
'
,
'
set
'
:
'
t
rain
ing
'
'
set
'
:
'
t
est
ing
'
},
},
'
training_data
'
:
{
'
training_data
'
:
{
'
database
'
:
'
iris/1
'
,
'
database
'
:
'
iris/1
'
,
'
protocol
'
:
'
Main
'
,
'
protocol
'
:
'
Main
'
,
'
set
'
:
'
t
est
ing
'
'
set
'
:
'
t
rain
ing
'
}
}
});
});
...
@@ -492,12 +492,12 @@ describe('<ExperimentEditor />', () => {
...
@@ -492,12 +492,12 @@ describe('<ExperimentEditor />', () => {
'
testing_data
'
:
{
'
testing_data
'
:
{
'
database
'
:
'
iris/1
'
,
'
database
'
:
'
iris/1
'
,
'
protocol
'
:
'
Main
'
,
'
protocol
'
:
'
Main
'
,
'
set
'
:
'
t
rain
ing
'
'
set
'
:
'
t
est
ing
'
},
},
'
training_data
'
:
{
'
training_data
'
:
{
'
database
'
:
'
iris/1
'
,
'
database
'
:
'
iris/1
'
,
'
protocol
'
:
'
Main
'
,
'
protocol
'
:
'
Main
'
,
'
set
'
:
'
t
est
ing
'
'
set
'
:
'
t
rain
ing
'
}
}
},
},
'
globals
'
:
{
'
globals
'
:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment