Comments (2)
Hi @Daviser95
The most simple solution I see is to predict in chunks. I would suggest dividing the projection region into tiles by creating a polygon with a regular grid. Then, write a loop tor project within each tile and merge the list of rasters into a single raster. Note that you can restring projection region using predict_area of the sdm_predict() function
r_tiles <- list()
for(i in 1:nrow(polytiles)){
r_tiles [[i]] <- sdm_predict(
models = ens_m,
pred = EnvVars,
thr = "max_sens_spec",
nchunk = 50,
con_thr = FALSE,
predict_area = polytiles[polytiles$id==i, ]
)
}
from flexsdm.
Hi @sjevelazco and thank you for this advice.
I am trying again to use the package for a different project, and after being able to get some predictions (the one with maxent), now I am getting a similar issue when making the prediction for other models (i.e., Error: std::bad_alloc
and/or Error: Cannot allocate a vector of size 1.0 Gb
). This is strange because I am working with a workstation with 128Gb RAM and there aren't other processes running and consuming memory). However, I was trying to predict in chunks, using a regular grid, and using your suggested code. I tried both with a SpatVector and with an sf object.
#load a regular grid for the study area
tiles_pol <- vect("G:/davide/africa/regular_grids.shp")
#crs(tiles_pol)<- "EPSG:4326"
r_tiles <- list()
for(i in 1:nrow(tiles_pol)){
r_tiles [[i]] <- sdm_predict(
models = f_glm,
pred = predictors_2km_ready_nrm,
thr = "max_sens_spec",
nchunk = 50,
con_thr = FALSE,
predict_area = tiles_pol[tiles_pol$ID==i, ]
)
}
but I am getting this error:
Predicting individual models
Errore in h(simpleError(msg, call)) :
errore durante la valutazione dell'argomento 'x' nella selezione di un metodo per la funzione 'mask': [crop] cannot crop a SpatRaster with an empty extent
While using this code:
for(i in 1:nrow(tiles_pol)){
r_tiles [[i]] <- sdm_predict(
models = f_glm,
pred = predictors_2km_ready_nrm,
thr = "max_sens_spec",
nchunk = 20,
predict_area = tiles_pol[tiles_pol]
)
}
I get:
Predicting individual models
Errore in (function (cond) :
errore durante la valutazione dell'argomento 'x' nella selezione di un metodo per la funzione 'mask': std::bad_alloc
I don't know if this error is related to the argument predict_area itself, because I was able to crop and mask the predictors with the spatvector regular grid, also using:
for(i in 1:nrow(tiles_pol)){
r_tiles [[i]] <- predictors_2km_ready_nrm %>%
crop(tiles_pol) %>%
mask(tiles_pol)
}
from flexsdm.
Related Issues (20)
- Memory overflow HOT 3
- rlayer argument in sample_background() function
- how to create multi band raster HOT 2
- Predicting PCA HOT 1
- Partial dependence plots for ensemble models HOT 1
- Subscript out of bounds HOT 1
- Evaluation over training dataset (explanatory power)
- occfilt_geo() only works with "x" and "y" columns HOT 1
- rev_jack breaks when v has more than one element
- response curves HOT 1
- correct_colinvar() for pearson method do not return 3 objects, only 2 objects HOT 1
- Allow extra_eval to calculate extrapolation for multiple environments
- Survey data bias grid example? HOT 1
- Can´t fit random effects with fit_gam? HOT 1
- bootstrap method using part_random requires presence-absence column to be named "pr_ab"
- part_sblock is using `&&` operators with vectors that have length bigger than 1 and is causing an error
- variable importance HOT 3
- error in occfilt_env HOT 1
- Installation problem HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flexsdm.