Giter Site home page Giter Site logo

Comments (10)

sgvignali avatar sgvignali commented on June 7, 2024

That's weird...
How did you create the map object? Could you please print it?

from sdmtune.

veroandreo avatar veroandreo commented on June 7, 2024

I'm following the examples in the tutorial, but with my data. Here the commands and objects:

map <- predict(default_model_2014_5, data = subset_pred_2014_5_r, type = "cloglog")
thresholds(default_model_2014_5, type = "cloglog")
plotPA(map, th = 0.20)


default_model_2014_5
Object of class SDMmodelCV 
Method: Maxent 

Species: LC 
Replicates: 4 
Presence locations: 25 
Absence locations: 10000 

Model configurations:
--------------------
fc: lqph
reg: 1
iter: 500

Variables:
---------
Continuous: LC08_2014_2015_cva_angle LC08_2014_2015_cva_change_dist_1 LC08_2014_2015_cva_change_dist_2 LC08_2014_2015_cva_change_dist_3 LC08_2014_2015_cva_change_dist_4 LC08_2014_2015_cva_magnitude LC08_20140719_EVI_5_Contr LC08_20140719_EVI_5_Corr LC08_20140719_EVI_5_Entr LC08_20140719_LSWI2_5_Corr LC08_20140719_LSWI2_5_Entr LC08_20140719_LSWI2_average_5 LC08_20140719_NDBI_5_Contr LC08_20140719_NDBI_5_Corr LC08_20140719_NDBI_5_Entr LC08_20140719_NDBI_sd_5 LC08_20140719_NDWI_XU_sd_5 LC08_20140719_tasscap.1_5 LC08_20140719_tasscap.2_5 LC08_20140719_tasscap.4_5 interspersion_20140719_5 richness_20140719_5 
Categorical: LC08_2014_2015_cva_change rf_class_20140719 mode_20140719_5 LC08_2014_2015_cva_change_mode_5


map_2014_5
class      : RasterLayer 
dimensions : 976, 1252, 1221952  (nrow, ncol, ncell)
resolution : 30, 30  (x, y)
extent     : 302040, 339600, 6940230, 6969510  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +south +no_defs +zone=21 +a=6378137 +rf=298.257223563 +towgs84=0.000,0.000,0.000 +to_meter=1 
source     : memory
names      : layer 
values     : 0, 1  (min, max)

If I just follow the example with the vitualsp and worldclim, and ony load SDMtune and raster packages, the plotPA() works. But with my data, it does not. I don't understand.

from sdmtune.

sgvignali avatar sgvignali commented on June 7, 2024

Thanks, are you sure you are using the version 0.2.0?

The predict function for cross validation is not available in this version. If you try to predict
an SWDmodelCV object you should get the following error message:

Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "SDMmodelCV"

Furthermore, the thresholds function can be used only with SDMmodel objects, see documentation.

The predict method for SDMmodelCV is implemented in the development version and will be released soon (thresholds will be available in the following days).

from sdmtune.

veroandreo avatar veroandreo commented on June 7, 2024

Sorry, I didn't say. I'm using the dev version installed with devtools::install_github("ConsBiol-unibern/SDMtune") because I saw that predict now also works with SDMmodelCV objects.

In any case, I tried the plotPA() also with a CV model with the data from the example in the tutorials, and it works. It's only with my data that it does not work.

from sdmtune.

sgvignali avatar sgvignali commented on June 7, 2024

plotPA is a simple function, must be something with your raster.

Could you please try to do

pa <- map >= 0.2
rasterVis::gplot(pa) + ggplot2::geom_tile(ggplot2::aes_(fill = ~value))

and also:

plot(map)
plot(pa)

from sdmtune.

veroandreo avatar veroandreo commented on June 7, 2024

All those commands work with no error :)

from sdmtune.

sgvignali avatar sgvignali commented on June 7, 2024

and this:

rasterVis::gplot(pa) +
  ggplot2::geom_tile(ggplot2::aes_(fill = ~value)) +
  ggplot2::scale_fill_manual(values = c("#67a9cf", "#ef8a62"),
                             breaks = c(1, 0),
                             labels = c("Presence", "Absence"),
                             name = "")

from sdmtune.

veroandreo avatar veroandreo commented on June 7, 2024

That one gives the error reported originally:

Error: Continuous value supplied to discrete scale

from sdmtune.

sgvignali avatar sgvignali commented on June 7, 2024

It should be fixed now, could you please test it?

Be aware that the function thresholds is not yet implemented for CV,
it will be available in few days...

from sdmtune.

veroandreo avatar veroandreo commented on June 7, 2024

It should be fixed now, could you please test it?

Yes, it's working now! Thanks much! I close this one as it is fixed.

Be aware that the function thresholds is not yet implemented for CV,
it will be available in few days...

+1! Looking forward to it
Thanks again! I like the package a lot!

from sdmtune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.