New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature_abundances function #86

jeffreyhanson opened this Issue May 17, 2018 · 2 comments


None yet
2 participants
Copy link

jeffreyhanson commented May 17, 2018

As discussed in #84, it would be good to have a function that returns the maximum amount of each feature in the planning units in a problem object to help with target setting. This function could probably use the x$feature_abundances_in_planning_units() and the x$feature_abundances_in_total_units methods for ConservationProblem objects. It could look something like feature_abundances(x, na.rm = TRUE) where it will return the data for planning units if na.rm=TRUE, other wise the data for total units if na.rm=FALSE (the planning units are "planning units" with non-NA cost values, and total units are "planning units" with NA cost values, e.g. NA pixels in raster planning unit data).


This comment has been minimized.

Copy link

javierfajnolla commented May 28, 2018

Thanks a lot for this, it is great to see that are so interesting in hearing the feedback form other users and so fast at working on them.

So, I have been testing the new function "feature_abundances()".

If I am right, the function returns the abundance of every species in all planning units (including NAs) or just in those with data (excluding NAs). But, still, planning units that are locked-out are not NAs, so there is no option to retrieve abundance in all planning units available to select, right?
I guess this requires some extra work, if there are not yet implemented methods part of the ConservationProblem objects... But I still think it would be useful!

Currently, I am using something similar to the add_max_features_objective() with really large budget approach that you suggested. Instead of that, I am just building a raster manually where each PU value is 1, except those locked-out, which are 0, and checking feature_representation using that raster as solution.

Thanks for the help!


This comment has been minimized.

Copy link

jeffreyhanson commented May 29, 2018

Yeah the feature abundance has a na.rm parameter which determines if planning units with NA values should be included in the calculations.

Yeah, that's right, there isn't an easy way to calculate the maximum possible representation for different features.

Yeah, that approach sounds great. Even though you're not using the add_max_features objective, I just wanted to say that the max features objective will aim to meet the targets for as many features as possible. But if it can't meet the targets for some species then it doesn't care if these species are represented at 0% or 90% of the target (so in many cases these species will be poorly represented in the solution). So if you really wanted to guarantee that all features are well represented in the solution, then I think you would need to use the min set objective with manually calculated targets (which it sounds like this is exactly what you're doing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment