Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
manuscript_code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maria Voigt
manuscript_code
Commits
eb11c024
Commit
eb11c024
authored
7 years ago
by
Maria Voigt
Browse files
Options
Downloads
Patches
Plain Diff
fixing bug in prediction
parent
c4d5a6d4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/prediction/abundance_prediction.R
+10
-5
10 additions, 5 deletions
src/prediction/abundance_prediction.R
with
10 additions
and
5 deletions
src/prediction/abundance_prediction.R
+
10
−
5
View file @
eb11c024
...
...
@@ -57,10 +57,12 @@ option_list <- list (
default
=
TRUE
,
help
=
"don't print all intermediate results"
))
# verbose option a bit counterintuitive
# because I make action store_false, when I say -q that
# means that verbose == F, which is quiet
print
(
"pass checkpoint"
)
option_list
options
<-
parse_args
(
OptionParser
(
option_list
=
option_list
))
...
...
@@ -102,7 +104,7 @@ if(is_verbose){print(paste("indir", indir))}
outdir
<-
options
$
output_directory
if
(
is_verbose
){
print
(
paste
(
"outdir"
,
outdir
))}
indir_model
<-
option
$
input_model
indir_model
<-
option
s
$
input_model
if
(
is_verbose
){
print
(
paste
(
"indir_model"
,
indir_model
))}
...
...
@@ -113,7 +115,7 @@ print(paste("for year to predict" , year_to_predict))
exclude_year
<-
as.numeric
(
options
$
exclude_year
)
if
(
is_verbose
){
print
(
paste
(
"exclude year"
,
exclude_year
))}
focal_change_predictor
<-
options
$
focal_change_predictor
focal_change_predictor
<-
as.numeric
(
options
$
focal_change_predictor
)
if
(
is_verbose
){
print
(
paste
(
"focal_change_predictor"
,
focal_change_predictor
))}
if
(
is_verbose
){
print
(
paste
(
Sys.time
(),
"0. start run"
))}
...
...
@@ -199,13 +201,14 @@ predictors_obs_path <- path.to.current(indir,
paste0
(
"predictors_observation_scaled_"
,
name_suffix
),
"rds"
)}
else
{
predictors_obs_path
<-
path.to.current
(
indir
,
"predictors_observation_scaled_"
,
predictors_obs_path
<-
path.to.current
(
indir
_model
,
"predictors_observation_scaled_"
,
"rds"
)}
if
(
is_verbose
){
print
(
paste
(
"this is predictors-obs path"
,
predictors_obs_path
))}
predictors_obs
<-
readRDS
(
predictors_obs_path
)
# Scale the grid-predictors using mean and sd of predictors_obs
# predictors for scaling
...
...
@@ -242,10 +245,12 @@ saveRDS(predictors_grid, file.path(outdir, paste0("predictors_grid_scaled_", nam
#-------------------------------------#
if
(
!
is.na
(
focal_change_predictor
)){
# load 1999 value to add the values, but use the scaled table
predictors_grid_1999_path
<-
path.to.current
(
indir
,
predictors_grid_1999_path
<-
path.to.current
(
indir
_model
,
paste0
(
"predictors_grid_scaled_"
,
1999
),
"rds"
)
print
(
predictors_grid_1999_path
)
predictors_grid_1999
<-
readRDS
(
predictors_grid_1999_path
)
change_predictors
<-
c
(
"year"
,
"peatswamp"
,
"lowland_forest"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment