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
Marco De Lucia
RedModRphree
Commits
6caf13b1
Commit
6caf13b1
authored
Jul 02, 2018
by
Janis Jatnieks
Browse files
Update Surr_Train.R for safer Residuals export + export of error indexes.
parent
e6aba3c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/Surr_Train.R
View file @
6caf13b1
...
...
@@ -1307,26 +1307,24 @@ WriteModelResiduals <- function(write_filepath_prefix, training_samples, seed) {
training_samples
),
collapse
=
"_"
),
collapse
=
""
)
}
## write out raw residuals for the best model combination
all_res
<<-
as.data.table
(
Residuals
)
## write names that mean something, so that you know what errors you are looking at
colnames
(
all_res
)
<-
paste
(
dt2v
(
Sperf
,
"output"
),
# for col length safety, extract first the vectors from Residuals list, then data.table
best_res
<<-
as.data.table
(
Residuals
[
perftop
[,
"model_id"
]
])
# write names that mean something, so that you know what errors you are looking at
colnames
(
best_res
)
<-
paste
(
dt2v
(
Sperf
,
"output"
),
dt2v
(
Sperf
,
"method"
),
dt2v
(
Sperf
,
"preprocessing"
),
sep
=
"_"
)
best_res
<<-
subset
(
all_res
,
select
=
perftop
[,
"model_id"
])
sep
=
"_"
)[
perftop
[,
"model_id"
]
]
# use only the names needed
## write all for testing and manual overview
#fwrite( all_res, "debug/all_residuals.csv" )
## write out only for those that have non-zero columns
fwrite
(
SelectActiveColumns
(
best_res
),
file
=
paste0
(
ensemble_name
,
"_residuals_best.csv"
))
## residuals are errors on validation data set - created as inverse from these indexes
fwrite
fwrite
(
as.data.table
(
inds
),
file
=
paste0
(
ensemble_name
,
"_train_inds.csv"
)
)
## err index export
err_inds
=
as.data.table
(
seq
(
nrow
(
Fout
))[
-
inds
]
)
colnames
(
err_inds
)
<-
"err_inds"
fwrite
(
as.data.table
(
err_inds
),
file
=
paste0
(
ensemble_name
,
"_err_inds.csv"
)
)
}
## once we have screened all the desired possibilities, we can try to
...
...
Write
Preview
Supports
Markdown
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