Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zeller Group
SIAMCAT
Commits
3308b2f7
Commit
3308b2f7
authored
Aug 02, 2021
by
Jakob Wirbel
Browse files
Fix error mentioned in
#25
: sel.idx needs to be named.
parent
31725fac
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/model_interpretation_plot.R
View file @
3308b2f7
...
...
@@ -173,7 +173,7 @@ model.interpretation.plot <-
verbose
=
verbose
)
num.sel.f
<-
length
(
sel.idx
)
# ######################################################################
# aggreate predictions and sort
# patients by score aggregate predictions of several models if more than
...
...
@@ -251,6 +251,7 @@ model.interpretation.plot <-
# Title of Feature Weights
if
(
verbose
>
2
)
message
(
"+++ plotting titles"
)
par
(
mar
=
c
(
0
,
1.1
,
3.1
,
1.1
))
plot
(
NULL
,
type
=
"n"
,
xlim
=
c
(
-0.1
,
0.1
),
xaxt
=
"n"
,
xlab
=
""
,
ylim
=
c
(
-0.1
,
0.1
),
yaxt
=
"n"
,
ylab
=
""
,
bty
=
"n"
...
...
@@ -880,11 +881,13 @@ model.interpretation.select.features <-
label
,
max.show
,
verbose
=
0
)
{
if
(
verbose
>
2
)
message
(
"+ model.interpretation.select.features"
)
# for linear models, select those that have been selected more than
# consens.thres percent of the models
if
(
model.type
!=
"
R
andomForest"
)
{
if
(
model.type
!=
"
r
andomForest"
)
{
sel.idx
=
which
(
feature.weights
$
percentage
>
consens.thres
)
names
(
sel.idx
)
<-
rownames
(
feature.weights
)[
sel.idx
]
# normalize by model size and order features by
# relative model weight
median.sorted.features
<-
...
...
@@ -919,6 +922,7 @@ model.interpretation.select.features <-
sel.idx
<-
median.sorted.features
$
ix
[
which
(
median.sorted.features
$
x
>=
consens.thres
)]
names
(
sel.idx
)
<-
rownames
(
feature.weights
)[
sel.idx
]
if
(
length
(
sel.idx
)
>
max.show
)
{
sel.idx
<-
tail
(
sel.idx
,
n
=
max.show
)
...
...
@@ -931,6 +935,7 @@ model.interpretation.select.features <-
length
(
sel.idx
),
"selected features"
))
if
(
length
(
sel.idx
)
==
0
)
stop
(
"No features were selected for plotting!"
)
if
(
verbose
>
2
)
message
(
"+ finished model.interpretation.select.features"
)
return
(
sel.idx
)
...
...
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