Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gateway
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HBP Medical Informatics Platform
gateway
Commits
4269bd51
Commit
4269bd51
authored
3 years ago
by
stevereis
Browse files
Options
Downloads
Patches
Plain Diff
Add naive bayes test
parent
6b27ef39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/src/engine/connectors/exareme/tests/e2e/naive-bayes.e2e-spec.ts
+78
-0
78 additions, 0 deletions
...gine/connectors/exareme/tests/e2e/naive-bayes.e2e-spec.ts
with
78 additions
and
0 deletions
api/src/engine/connectors/exareme/tests/e2e/naive-bayes.e2e-spec.ts
0 → 100644
+
78
−
0
View file @
4269bd51
import
{
Test
,
TestingModule
}
from
'
@nestjs/testing
'
;
import
{
RawResult
}
from
'
src/engine/models/result/raw-result.model
'
;
import
{
AppModule
}
from
'
../../../../../main/app.module
'
;
import
{
ENGINE_SERVICE
}
from
'
../../../../engine.constants
'
;
import
{
IEngineService
}
from
'
../../../../engine.interfaces
'
;
import
{
ExperimentCreateInput
}
from
'
../../../../models/experiment/input/experiment-create.input
'
;
import
{
createExperiment
,
generateNumber
,
TEST_PATHOLOGIES
,
TIMEOUT_DURATION_SECONDS
,
waitForResult
,
}
from
'
../../interfaces/test-utilities
'
;
jest
.
setTimeout
(
1000
*
TIMEOUT_DURATION_SECONDS
);
describe
(
'
ExaremeService
'
,
()
=>
{
let
exaremeService
:
IEngineService
;
beforeEach
(
async
()
=>
{
const
moduleRef
:
TestingModule
=
await
Test
.
createTestingModule
({
imports
:
[
AppModule
],
}).
compile
();
exaremeService
=
await
moduleRef
.
resolve
<
IEngineService
>
(
ENGINE_SERVICE
);
});
const
modelSlug
=
`naivebayes-
${
generateNumber
()}
`
;
const
algorithmId
=
'
NAIVE_BAYES
'
;
const
input
:
ExperimentCreateInput
=
{
name
:
modelSlug
,
variables
:
[
'
alzheimerbroadcategory
'
],
coVariables
:
[
'
righthippocampus
'
,
'
lefthippocampus
'
],
datasets
:
TEST_PATHOLOGIES
.
dementia
.
datasets
.
filter
((
d
)
=>
d
.
code
!==
'
fake_longitudinal
'
)
.
map
((
d
)
=>
d
.
code
),
domain
:
TEST_PATHOLOGIES
.
dementia
.
code
,
algorithm
:
{
id
:
algorithmId
,
type
:
'
string
'
,
parameters
:
[
{
id
:
'
alpha
'
,
value
:
[
'
0.1
'
],
},
{
id
:
'
k
'
,
value
:
[
'
10
'
],
},
],
},
filter
:
''
,
};
describe
(
'
Integration Test for experiment API
'
,
()
=>
{
it
(
`create
${
algorithmId
}
`
,
async
()
=>
{
const
experiment
=
await
createExperiment
(
input
,
exaremeService
);
expect
(
experiment
).
toBeTruthy
();
expect
(
experiment
?.
status
).
toStrictEqual
(
'
pending
'
);
expect
(
experiment
?.
id
).
toBeTruthy
();
const
experimentResult
=
await
waitForResult
(
experiment
?.
id
??
''
,
exaremeService
,
);
expect
(
experimentResult
).
toBeTruthy
();
expect
(
experimentResult
.
status
).
toStrictEqual
(
'
success
'
);
expect
(
experimentResult
.
results
.
length
).
toBeGreaterThanOrEqual
(
5
);
const
data
=
experimentResult
.
results
[
0
]
as
RawResult
;
expect
(
data
.
rawdata
[
'
data
'
][
'
precision
'
][
0
]).
toBeCloseTo
(
0.517
,
3
);
});
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
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