Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fractalis
fractalis
Commits
0a6d4fe7
Commit
0a6d4fe7
authored
Aug 17, 2017
by
Sascha Herzinger
Browse files
fixed a bug in the heatmap code
parent
e370b0f3
Pipeline
#2265
failed with stage
in 1 minute and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fractalis/analytics/tasks/heatmap/main.py
View file @
0a6d4fe7
...
...
@@ -33,7 +33,7 @@ class HeatmapTask(AnalyticTask):
df
=
reduce
(
lambda
a
,
b
:
a
.
append
(
b
),
numerical_arrays
)
if
not
subsets
:
# empty subsets equals all samples in one subset
subsets
=
df
[
'id'
].
unique
()
subsets
=
[
df
[
'id'
].
unique
()
.
tolist
()]
else
:
# if subsets are defined we drop the rows that are not part of one
flattened_subsets
=
[
x
for
subset
in
subsets
for
x
in
subset
]
...
...
tests/heatmap/test_main.py
View file @
0a6d4fe7
...
...
@@ -61,3 +61,25 @@ class TestHeatmap:
id_filter
=
[],
subsets
=
subsets
)
assert
'specified subsets does not match'
in
e
def
test_empty_subset_equals_full_subset
(
self
):
numerical_arrays
=
[
pd
.
DataFrame
([[
101
,
'foo'
,
5
],
[
101
,
'bar'
,
6
],
[
102
,
'foo'
,
10
],
[
102
,
'bar'
,
11
],
[
103
,
'foo'
,
15
],
[
103
,
'bar'
,
16
],
[
104
,
'foo'
,
20
],
[
104
,
'bar'
,
21
]],
columns
=
[
'id'
,
'feature'
,
'value'
])
]
result_1
=
self
.
task
.
main
(
numerical_arrays
=
numerical_arrays
,
numericals
=
[],
categoricals
=
[],
ranking_method
=
'mean'
,
id_filter
=
[],
subsets
=
[])
result_2
=
self
.
task
.
main
(
numerical_arrays
=
numerical_arrays
,
numericals
=
[],
categoricals
=
[],
ranking_method
=
'mean'
,
id_filter
=
[],
subsets
=
[[
101
,
102
,
103
,
104
]])
assert
result_1
==
result_2
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment