Comments (4)
Ok sounds great - thanks @ricschuster and @Martin-Jung! I'll update prioritizr to throw errors if a user supplies a categorical raster.
from prioritizr.
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.
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.
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)
- Error while solving the problem HOT 10
- package overview manual entry
- Add linear constraints for multiple zones HOT 3
- lexicographic (hierachical) multi-objective optimization HOT 5
- Add max area threshold for zone and dealing with fragmented zones HOT 25
- Improve presolve checks HOT 1
- ℹ In argument to `x`. Caused by `problems(pu, features = multi_layer)` HOT 7
- write_problem() doesn't work
- Ph.D. HOT 2
- How should I incorporate a risk layer? Penalty, feature, feature weight? HOT 7
- Add proximity-based metrics for irreplaceability
- Cost in problems with zones HOT 2
- PrioritizR vs. traditional Weighted Overlay (land use planning example) HOT 5
- Optimization Suggestion: Excessive Memory Usage during Processing HOT 7
- Add new vignette to describe "lines" issue HOT 2
- Return the optimality gap of a solution HOT 6
- Invalid error message when using linear penalties/constraints with NA values
- Constraining the Solution in Prioritizr HOT 3
- Max constraint violation HOT 3
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 prioritizr.