Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2502172
NaNs.R
aekavur (Ali Emre Kavur)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
aekavur
Feb 8 2022, 2:12 PM
2022-02-08 14:12:08 (UTC+1)
Size
3 KB
Referenced Files
None
Subscribers
None
NaNs.R
View Options
library
(
devtools
)
library
(
challengeR
)
data_matrix
<-
read.csv
(
"C:/Users/a446r/Desktop/csv_files/data_matrix_NaN.csv"
)
# type ?read.csv for help
bootstrapSamples
<-
10
naTreat
=
'na.rm'
# naTreat = 0
challenge
<-
as.challenge
(
data_matrix
,
by
=
"task"
,
algorithm
=
"alg_name"
,
case
=
"case"
,
value
=
"value"
,
na.treat
=
naTreat
,
smallBetter
=
TRUE
)
ranking1
<-
challenge
%>%
aggregateThenRank
(
FUN
=
mean
,
na.treat
=
naTreat
,
ties.method
=
"min"
)
ranking2
<-
challenge
%>%
rankThenAggregate
(
FUN
=
mean
,
ties.method
=
"min"
)
ranking3
<-
challenge
%>%
testThenRank
(
alpha
=
0.05
,
p.adjust.method
=
"none"
,
na.treat
=
naTreat
,
ties.method
=
"min"
)
# Get Consensus Ranking ---------------------------------------------------
meanRanks1
<-
ranking1
%>%
consensus
(
method
=
"euclidean"
)
meanRanks2
<-
ranking2
%>%
consensus
(
method
=
"euclidean"
)
meanRanks3
<-
ranking3
%>%
consensus
(
method
=
"euclidean"
)
# Prepare Bootsrapped Versions --------------------------------------------
if
(
bootstrapSamples
>
0
)
{
set.seed
(
1
)
rankingBootstrapped1
<-
ranking1
%>%
bootstrap
(
nboot
=
bootstrapSamples
)
rankingBootstrapped2
<-
ranking2
%>%
bootstrap
(
nboot
=
bootstrapSamples
)
rankingBootstrapped3
<-
ranking3
%>%
bootstrap
(
nboot
=
bootstrapSamples
)
ranking1_bootstrap
<-
rankingBootstrapped1
ranking2_bootstrap
<-
rankingBootstrapped2
ranking3_bootstrap
<-
rankingBootstrapped3
}
## Generate the reports
# AggregateThenRank -------------------------------------------------------
ranking1
%>%
report
(
consensus
=
meanRanks1
,
title
=
"AggregateThenRank with Na threat"
,
file
=
"AggregateThenRank"
,
format
=
"PDF"
,
clean
=
TRUE
,
open
=
FALSE
,)
# AggregateThenRank with Bootstrap -----------------------------------------
ranking1_bootstrap
%>%
report
(
consensus
=
meanRanks1
,
title
=
"AggregateThenRank with Na threat and Bootstrap"
,
file
=
"AggregateThenRank_bootstrap"
,
format
=
"PDF"
,
clean
=
TRUE
,
open
=
FALSE
,)
# RankThenAggregate -------------------------------------------------------
ranking2
%>%
report
(
consensus
=
meanRanks2
,
title
=
"RankThenAggregate with Na threat"
,
file
=
"RankThenAggregate"
,
format
=
"PDF"
,
clean
=
TRUE
,
open
=
FALSE
,)
# RankThenAggregate with Bootstrap -----------------------------------------
ranking2_bootstrap
%>%
report
(
consensus
=
meanRanks2
,
title
=
"RankThenAggregate with Na threat and Bootstrap"
,
file
=
"RankThenAggregate_bootstrap"
,
format
=
"PDF"
,
clean
=
TRUE
,
open
=
FALSE
,)
# TestThenRank ------------------------------------------------------------
ranking3
%>%
report
(
consensus
=
meanRanks3
,
title
=
"TestThenRank with Na threat"
,
file
=
"TestThenRank"
,
format
=
"PDF"
,
clean
=
TRUE
,
open
=
FALSE
,)
# TestThenRank with Bootstrap ---------------------------------------------
ranking3_bootstrap
%>%
report
(
consensus
=
meanRanks3
,
title
=
"TestThenRank with Na threat and Bootstrap"
,
file
=
"TestThenRank_bootstrap"
,
format
=
"PDF"
,
clean
=
TRUE
,
open
=
FALSE
,)
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1500003
Default Alt Text
NaNs.R (3 KB)
Attached To
Mode
T28746: [dash] NaN values cause error
Attached
Detach File
Event Timeline
Log In to Comment