Comments (3)
Thanks for reporting the error, I will check it today or tomorrow.
from sdmtune.
The error happens because the function "predict" in the randomForest package expects to have a factor for the "biome" variable, but in the raster object "biome" is a numeric variable.
To avoid this error you can pass an additional argument to the predict function. The predict function for raster dataset implemented in SDMtune uses the predict function implemented in the raster package https://rdrr.io/cran/raster/man/predict.html. You can use the factors argument to pass the levels of the "biome" factor. Here is the code:
f <- list(biome = levels(data@data$biome))
map <- predict(default_model, data = predictors, factors = f)
Note that the factors argument is a named list. You have to match the name with the name of the raster layer, in this case biome.
Be aware that you might have to handle cases in which there are more levels in the raster layer compared to the training dataset (google it and you will find some examples).
from sdmtune.
from sdmtune.
Related Issues (20)
- Thanks for that great tool...
- [BUG] modelReport() using RF method: type of predictors in new data do not match that of the training data. HOT 2
- Response Curve error when creating model report HOT 2
- Error when plotting response for categorical predictors -RF-class [BUG] HOT 2
- Problems running the spatial cross validation examples HOT 5
- [BUG] varSel not working after model train HOT 4
- Disable real-time graph??? HOT 2
- modelReport can't find ROC curve file and fails HOT 7
- How to parse the result from `reduceVar()` to get retained var names? HOT 1
- [Enhancement] Accepting single raster as well HOT 1
- [help wanted] where can set up the bias file of maxent and How to get the model files incliding roc curves, TSS csv tables and responce curves?
- [Bug]:doJK freezes when a continuous variable has many zeros HOT 1
- [Bug]: Please remove dependencies on **rgdal**, **rgeos**, and/or **maptools** HOT 3
- [Bug]: The package is not accepting new blockCV version (3.0) HOT 1
- [Feature request]: HOT 4
- Error in plotPA: Continuous value supplied to discrete scale HOT 10
- [BUG] plotPA not working in version 1.10 HOT 12
- [BUG] cluster error during predict with large raster stack HOT 5
- modelReport fails if response_curves = TRUE or jk=TRUE HOT 14
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 sdmtune.