Skip to content
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

Generating importance values for solutions #324

Open
edwardsmarc opened this issue Jun 13, 2023 · 4 comments
Open

Generating importance values for solutions #324

edwardsmarc opened this issue Jun 13, 2023 · 4 comments
Labels
sometime Feature that might be good to incorporate eventually, but not a priority

Comments

@edwardsmarc
Copy link
Contributor

edwardsmarc commented Jun 13, 2023

The following ideas came out of meetings with the BC pilot project team. Recognizing that for some scenarios (especially when no Includes are used), repeating the same run could give different solutions (i.e. because we use an optimality gap of 10% in WTW), they are interested in reporting importance scores for each planning unit. There could be multiple approaches to this which I'll list for discussion here, roughly in order of difficulty to implement:

Export rij marix into csv or shapefile

  • So user can view/calculate the contribution of each PU manually
  • This info is already included in the input attribute table. The input attribute table could be joined to the solution file using the _index column
  • This would require exporting a shp of the solution with the _index values in the attribute table
  • Alternatively, to get rasters of a given Theme in the solution, users can download the solution and mask the Themes from the tiff folder to the solution in ArcGIS. Note that if the pu's are polygons, then the download exports the shapefile with the requested Themes values as columns

Count the number of goals each PU contributes to

  • The idea here would be to calculate the number of goals each planning unit in the solution contributes to. This would basically be a count of themes values > 0 for every PU in the solution
  • A more sophisticated calculation could be to use eval_rare_richness_importance() or eval_replacement_importance() from prioritizr
  • The trick here could be conveying the actual value for each cell in leaflet to the user. Can't use popups with rasters. We might need to consider a polygon layer.

Calculate the resiliency index of each solution PU

  • The output here would be the resiliency index info for every PU in the solution. Again, this would require thought on how to visualize the values and we might need to use polygons instead of rasters to allow users to view the values in each PU.
  • Calculating this on-the-fly would likely be slow because we'd need to clip all the layers and calculate the sums etc. For the 1km grid, we could have a pre-computed grid of resiliency values that gets overlaid with the solution in WTW after a solution is generated. Users would be limited to the pre-defined resiliency attributes but viz would be fast.

Portfolio

  • An additional feature would be using the portfolio functions in prioritizr to generate say the top 10 solutions for a problem, then showing the number of times each PU was selected across the portfolio.
  • This would give a nice indication of PU importance as well as variance in solutions
@edwardsmarc edwardsmarc added help wanted Extra attention is needed question Further information is requested labels Jun 13, 2023
@edwardsmarc
Copy link
Contributor Author

Now thinking that these kinds of analyses will be conducted post-WTW. Ultimately the WTW solution will get processed in the Resiliency Index. But users may still want to do their own GIS analysis on the solutions. The following are my recommendations for now:

Export rij marix

  • Users should download the solution tif, and use it to mask the input tif layers they are interested in.
  • From there they can access the values by converting to a vector.
  • An R script and/or vignette could be useful for demonstrating this workflow. Maybe the script can mask all the input rasters and save in a new folder, and create a csv table of all the values.
  • Note that it would still be more convenient to export this info from WTW but we are trying to avoid adding WTW code until we have more info/examples of how users will use the output. Ultimately I'd love to export a dataset object where the dataset$attributes has been subset to the solution PUs.

Count number of goals each PU contributes to

  • This is hard to do outside WTW because you need to know which goals passed. Place this idea on hold for now.

Calculate resiliency index of each solution PU

  • This will be covered in the Resiliency Index tool, not in WTW.

Portfolio

  • This might be too much for WTW. It would make more sense to test the variation in solutions using the optimality gap and report the results so users know how much variation from the optimal solution they can expect. I don't expect much variation because most of our problems are very complex.

@edwardsmarc edwardsmarc added sometime Feature that might be good to incorporate eventually, but not a priority and removed help wanted Extra attention is needed question Further information is requested labels Jun 23, 2023
@ricschuster
Copy link
Contributor

Thanks very much @edwardsmarc !

This one Count number of goals each PU contributes to wouldn't be hard to do as the information can be extracted by using the rij matrix and a solution. Selecting the rows (species and such) from the rij matrix that correspond to a pu would give you this result. Not sure how easy that is in GIS, but in R its super simple to do.

@edwardsmarc
Copy link
Contributor Author

Thanks very much @edwardsmarc !

This one Count number of goals each PU contributes to wouldn't be hard to do as the information can be extracted by using the rij matrix and a solution. Selecting the rows (species and such) from the rij matrix that correspond to a pu would give you this result. Not sure how easy that is in GIS, but in R its super simple to do.

Agreed, we'd also need to subset by themes that met their goals.

I'm realising we don't really have a good way to export the WTW data for further analysis. We can download the solution tif and summary info, but we don't have a way to subset by goals passed or by solution. It would be pretty handy if we just exported the rij matrix (wtw dataset objects) for passed and missed goals as two .rds objects.

@edwardsmarc
Copy link
Contributor Author

This is related to #358 which is one implementation of the ideas documented in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sometime Feature that might be good to incorporate eventually, but not a priority
Projects
None yet
Development

No branches or pull requests

2 participants