Giter Site home page Giter Site logo

Comments (4)

jeffreyhanson avatar jeffreyhanson commented on June 1, 2024 1

Ok sounds great - thanks @ricschuster and @Martin-Jung! I'll update prioritizr to throw errors if a user supplies a categorical raster.

from prioritizr.

jeffreyhanson avatar jeffreyhanson commented on June 1, 2024

Hey,

Happy new years! Thank you very much for raising this issue! I imagine this could be confusing for a new user that's familiar with categorical rasters (honestly, I had no idea categorical rasters existed). I think the best option might be to either (1) convert them automatically to numeric rasters (using as.numeric()), or (2) throw a clear error saying that categorical rasters are not supported and tell the user to convert them manually.

Can you think of any issues/situations with (1) (i.e., using as.numeric()), where prioritizr might automatically convert a categorical raster to a numeric raster and, as a consequence, produce an output that doesn't align with the users intent? For example, imagine if a user has a categorical feature raster wherein different pixel values/classes correspond to different ecosystem types, then each pixel value is a different feature. In this case, I imagine using as.numeric() automatically in prioritizr would result in prioritizr incorrectly proccessing the data. This is because using as.numeric() would produce a single integer layer, when the user actually needed multiple binary layers so each ecosystem type is represented as a different feature. Is that right? Or maybe I'm misunderstanding something?

from prioritizr.

ricschuster avatar ricschuster commented on June 1, 2024

I personally would go with (2) and throw a clear error. Option (1) makes assumptions that might not be correct and I think it would be better if users need to think about what to do rather than the package assuming what a user might want.

What do you think?

from prioritizr.

Martin-Jung avatar Martin-Jung commented on June 1, 2024

Conversion factor to numeric 1):
Mhh, there could be potentially issues in this if a user has for some reason differently labelled categories that do not align with the numeric values. In this case numeric values are assigned based on the factor level order. For example:

a <- c("1", "3", "4") |> as.factor()
as.numeric(a)

So in that case I agree with Richard and think option 2) (assert_that call checking whether categorical rasters are supplied throughout) would be preferable.

from prioritizr.

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.