Hi,
Thank you for your package.
I was interested in the way you managed to use the predict-function on a raster stack/stars object.
I'm not doing any species distribution modeling, but I was interested in using your probability function.
However, when trying to run the function, I got the following error:
Error in probability(bio_for, env_vars) :
Please format inputs to stars object with x and y dimensions only, and distribute variables to attributes.
Since I'm very new to the stars-package. I have no clue how to "distribute variables to attributes".
I tried to read your code from the isotree_po-function and found you use split(3) when a stars-object has 3 dimensions, but inserting the result of that call into the probability-function did not work either.
So how can I prepare the stars-object with the variables as attributes?
Here is a reproducible example of what I was trying to do:
env_vars <- system.file(
'extdata/bioclim_tanzania_10min.tif',
package = 'itsdm') %>%
read_stars() %>%
slice('band', c(1, 5, 12))
bio_mat <- occ_virtual_species %>%
select(x,y) %>%
as.matrix() %>%
st_extract(x = env_vars, at =.)
bio_for <- isolation.forest(bio_mat,
ndim=3,
ntrees=10,
missing_action="fail")
probability(bio_for, env_vars)
Hi,
Thank you for your package.
I was interested in the way you managed to use the
predict-function on a raster stack/stars object.I'm not doing any species distribution modeling, but I was interested in using your
probabilityfunction.However, when trying to run the function, I got the following error:
Since I'm very new to the
stars-package. I have no clue how to "distribute variables to attributes".I tried to read your code from the
isotree_po-function and found you usesplit(3)when astars-object has 3 dimensions, but inserting the result of that call into theprobability-function did not work either.So how can I prepare the
stars-object with the variables as attributes?Here is a reproducible example of what I was trying to do: