Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MPBA
INF
Commits
7507f448
Commit
7507f448
authored
Nov 21, 2019
by
Marco Chierici
Browse files
Import only required modules from mlpy
parent
bedbd3ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
sklearn_rf_training_fixrank.py
View file @
7507f448
...
...
@@ -4,12 +4,11 @@
## Requires Python >= 2.7, mlpy >= 3.5
from
__future__
import
division
import
numpy
as
np
import
csv
import
os.path
from
scaling
import
norm_l2
import
mlp
y
from
mlpy
import
bootstrap_ci
,
borda_count
,
canberra_stabilit
y
from
input_output
import
load_data
import
performance
as
perf
import
sys
...
...
@@ -233,31 +232,31 @@ ADOR_APPROX = (ASENS / (1 - ASPEC)) / ((1 - ASENS) / ASPEC)
# confidence intervals
NPVCI
=
[]
for
i
in
range
(
NPV
.
shape
[
1
]):
NPVCI
.
append
(
mlpy
.
bootstrap_ci
(
NPV
[:,
i
]))
NPVCI
.
append
(
bootstrap_ci
(
NPV
[:,
i
]))
PPVCI
=
[]
for
i
in
range
(
PPV
.
shape
[
1
]):
PPVCI
.
append
(
mlpy
.
bootstrap_ci
(
PPV
[:,
i
]))
PPVCI
.
append
(
bootstrap_ci
(
PPV
[:,
i
]))
SENSCI
=
[]
for
i
in
range
(
SENS
.
shape
[
1
]):
SENSCI
.
append
(
mlpy
.
bootstrap_ci
(
SENS
[:,
i
]))
SENSCI
.
append
(
bootstrap_ci
(
SENS
[:,
i
]))
SPECCI
=
[]
for
i
in
range
(
SPEC
.
shape
[
1
]):
SPECCI
.
append
(
mlpy
.
bootstrap_ci
(
SPEC
[:,
i
]))
SPECCI
.
append
(
bootstrap_ci
(
SPEC
[:,
i
]))
MCCCI
=
[]
for
i
in
range
(
MCC
.
shape
[
1
]):
MCCCI
.
append
(
mlpy
.
bootstrap_ci
(
MCC
[:,
i
]))
MCCCI
.
append
(
bootstrap_ci
(
MCC
[:,
i
]))
AUCCI
=
[]
for
i
in
range
(
AUC
.
shape
[
1
]):
AUCCI
.
append
(
mlpy
.
bootstrap_ci
(
AUC
[:,
i
]))
AUCCI
.
append
(
bootstrap_ci
(
AUC
[:,
i
]))
DORCI
=
[]
for
i
in
range
(
DOR
.
shape
[
1
]):
DORCI
.
append
(
mlpy
.
bootstrap_ci
(
DOR
[:,
i
]))
DORCI
.
append
(
bootstrap_ci
(
DOR
[:,
i
]))
ACCCI
=
[]
for
i
in
range
(
ACC
.
shape
[
1
]):
ACCCI
.
append
(
mlpy
.
bootstrap_ci
(
ACC
[:,
i
]))
ACCCI
.
append
(
bootstrap_ci
(
ACC
[:,
i
]))
# Borda list
BORDA_ID
,
_
,
BORDA_POS
=
mlpy
.
borda_count
(
RANKING
)
BORDA_ID
,
_
,
BORDA_POS
=
borda_count
(
RANKING
)
# optimal number of features (yielding max MCC)
opt_feats
=
FSTEPS
[
np
.
argmax
(
AMCC
)]
...
...
@@ -265,7 +264,7 @@ opt_feats = FSTEPS[np.argmax(AMCC)]
STABILITY
=
[]
PR
=
np
.
argsort
(
RANKING
)
for
ss
in
FSTEPS
:
STABILITY
.
append
(
mlpy
.
canberra_stability
(
PR
,
ss
)
)
STABILITY
.
append
(
canberra_stability
(
PR
,
ss
)
)
metrics_w
.
writerow
([
"FS_WITH_BEST_MCC"
,
opt_feats
])
metrics_w
.
writerow
([
"STEP"
,
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment