Skip to content

Commit 8a13f33

Browse files
committed
v2025.08.11 rename model explainer docx to avoid mac install error due to characters
1 parent 09f93b3 commit 8a13f33

5 files changed

Lines changed: 420 additions & 400 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: gbm.auto
22
Title: Automated Boosted Regression Tree Modelling and Mapping Suite
3-
Version: 2025.03.06
3+
Version: 2025.08.11
44
Authors@R: person("Simon", "Dedman", , "simondedman@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9108-972X"))
55
Description: Automates delta log-normal boosted regression tree abundance
66
prediction. Loops through parameters provided (LR (learning rate), TC

Gbm.auto_extras/2023-12-21_ML­_Model_­evaluation_TLDR_explainer.docx renamed to Gbm.auto_extras/ML­_Model_evaluation_explainer.docx

File renamed without changes.

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22
title: "NEWS.md"
33
author: "Simon Dedman"
4-
date: "2024-10-01"
4+
date: "2025-08-11"
55
output: html_document
66
---
7+
#v2025.08.11
8+
* renamed ML model explainer docx to remove hyphens for mac installs
9+
710
# v2025.03.06
811
* grids and samples data objects in data.R renamed to MyGrids and MySamples, and references to them updated in all script run examples. Fixes scope conflict whereby grids data would be in the environment when gbm.auto is run with grids parameter defaulting to NULL.
912

README.Rmd

Lines changed: 179 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,176 +1,179 @@
1-
---
2-
output: github_document
3-
---
4-
5-
<!-- README.md is generated from README.Rmd. Please edit that file -->
6-
7-
```{r, include = FALSE}
8-
knitr::opts_chunk$set(
9-
collapse = TRUE,
10-
comment = "#>",
11-
fig.path = "man/figures/README-",
12-
out.width = "100%"
13-
)
14-
```
15-
16-
# gbm.auto
17-
18-
<!-- badges: start -->
19-
[![R-CMD-check](https://github.com/SimonDedman/gbm.auto/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/SimonDedman/gbm.auto/actions/workflows/R-CMD-check.yaml)
20-
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/gbm.auto)](https://cran.r-project.org/package=gbm.auto)
21-
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/gbm.auto)](https://cran.r-project.org/package=gbm.auto)
22-
<!-- badges: end -->
23-
<!-- badgeplacer(location = ".", status = "active", githubaccount = SimonDedman, githubrepo = gbm.auto, branch = master, name = "README.Rmd") -->
24-
25-
Automatically runs numerous processes from R packages 'gbm' and 'dismo' and script 'gbm.utils.R' which contains Elith et al.'s functions: roc, calibration, and gbm.predict.grids, as well as running my packages gbm.bfcheck, gbm.basemap, gbm.map, gbm.rsb, gbm.cons, gbm.valuemap, and gbm.loop.
26-
27-
Also see each script's Details section in the manual pages, as these frequently contain tips or common bugfixes.
28-
29-
I strongly recommend that you download papers 1 to 5 (or just the doctoral thesis) on <https://www.simondedman.com>, with emphasis on P4 (the guide) and P1 (statistical background). Elith et al 2008 (<https://besjournals.onlinelibrary.wiley.com/doi/10.1111/j.1365-2656.2008.01390.x>) is also strongly recommended. Also it's imperative you read the R help files for each function before you use them. In RStudio: Packages tab, scroll to gbm.auto, click its name, the click the function to see its man (manual) page. Read the whole thing. Function man pages can also be accessed from the console by typing
30-
31-
``` r
32-
?function
33-
```
34-
35-
Just because you CAN try every conceivable combination of tc, lr, bf, all, at once doesn't mean you should. Try a range of lr in shrinking orders of magnitude from 0.1 to 0.000001, find the best, THEN try tc c(2, n.expvars), find the best THEN bf c(0.5, 0.75, 0.9) and then in between if either outperform 0.5.
36-
37-
***
38-
39-
### gbm.auto
40-
41-
Automated Boosted Regression Tree modelling and mapping suite
42-
43-
Automates delta log normal boosted regression trees abundance prediction. Loops through all permutations of parameters provided (learning rate, tree complexity, bag fraction), chooses the best, then simplifies it. Generates line, dot and bar plots, and outputs these and the predictions and a report of all variables used, statistics for tests, variable interactions, predictors used and dropped, etc. If selected, generates predicted abundance maps, and Unrepresentativeness surfaces.
44-
45-
***
46-
47-
### gbm.bfcheck
48-
49-
Calculates minimum Bag Fraction size for gbm.auto
50-
51-
Provides minimum bag fractions for gbm.auto, preventing failure due to bf & samples rows limit.
52-
53-
***
54-
55-
### gbm.basemap
56-
57-
Creates Basemaps for Gbm.auto mapping from your data range
58-
59-
Downloads unzips crops & saves NOAAs global coastline shapefiles to user-set box. Use for 'shape' in gbm.map. If downloading in RStudio uncheck "Use secure download method for HTTP" in Tools > Global Options > Packages.
60-
61-
***
62-
63-
### gbm.map
64-
65-
Maps of predicted abundance from Boosted Regression Tree modelling
66-
67-
Generates maps from the outputs of gbm.step then gbm.predict.grids, handled automatically within gbm.auto but can be run alone, and generates representativeness surfaces from the output of gbm.rsb.
68-
69-
***
70-
71-
### gbm.rsb
72-
73-
Representativeness Surface Builder
74-
75-
Loops through explanatory variables comparing their histogram in 'samples' to their histogram in 'grids' to see how well the explanatory variable range in samples represents the range being predicted to in grids. Assigns a representativeness score per variable per site in grids, and takes the average score per site if there's more than 1 expvar. Saves this to a CSV; it's plotted by gbm.map if called in gbm.auto. This shows you which areas have the most and least representative coverage by samples, therefore where you can have the most/least confidence in the predictions from gbm.predict.grids.
76-
Can be called directly, and choosing a subset of expvars allows one to see their individual / collective representativeness.
77-
78-
***
79-
80-
### gbm.cons
81-
82-
Conservation Area Mapping
83-
84-
Runs gbm.auto for multiple subsets of the same overall dataset and scales the combined results, leading to maps which highlight areas of high conservation importance for multiple species in the same study area e.g. using juvenile and adult female subsets to locate candidate nursery grounds and spawning areas respectively.
85-
86-
***
87-
88-
### gbm.valuemap
89-
90-
Decision Support Tool that generates (Marine) Protected Area options using species predicted abundance maps
91-
92-
Scales response variable data, maps a user-defined explanatory variable to be avoided, e.g. fishing effort, combines them into a map showing areas to preferentially close. Bpa, the precautionary biomass required to protect the spawning stock, is used to calculate MPA size. MPA is then grown to add subsequent species starting from the most conservationally at-risk species, resulting in one MPA map per species, and a multicolour MPA map of all. All maps list the percentage of the avoid-variables total that is overlapped by the MPA in the map legend.
93-
94-
***
95-
96-
### gbm.loop
97-
98-
Calculate Coefficient Of Variation surfaces for gbm.auto predictions
99-
100-
Processes a user-specified number of loops through the same gbm.auto parameter combinations and calculates the Coefficient Of Variation in the predicted abundance scores for each site aka cell. This can be mapped to spatially demonstrate the output variance range.
101-
102-
***
103-
104-
### gbm.factorplot
105-
106-
ggplot-based update to PDP for factorial/categorical/character variables, allows changing order of categorical variables, and changing angle of x-axis labels to avoid them being cut off.
107-
108-
***
109-
110-
### lmplot
111-
112-
Linear plot of two variables.
113-
114-
***
115-
116-
### gbm.lmplots
117-
118-
Loops through lmplots for all expvars (x) against the same resvar (y).
119-
120-
***
121-
122-
### roc & calibration
123-
124-
Internal functions authored by Elith & Leathwick, used by gbm.auto.R
125-
126-
***
127-
128-
### gbm.step.sd
129-
130-
Local copy of dismo's gbm.step, with added functions to generate model evaluation metrics such as root mean squared error and amount of deviance explained relative to null.
131-
132-
***
133-
134-
## Installation
135-
136-
You can install the released version of gbm.auto from [CRAN](https://CRAN.R-project.org) with:
137-
138-
``` r
139-
install.packages("gbm.auto")
140-
```
141-
142-
And the development version from [GitHub](https://github.com/) with:
143-
144-
``` r
145-
# install.packages("devtools")
146-
remotes::install_github("SimonDedman/gbm.auto")
147-
```
148-
149-
***
150-
151-
## Example
152-
153-
(See each function's help file for specific examples, and the documents listed above)
154-
155-
***
156-
157-
## ToDo List
158-
159-
See GitHub issues section https://github.com/SimonDedman/gbm.auto/issues
160-
Feel free to contribute to this!
161-
162-
<!-- What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so: -->
163-
164-
<!-- ```{r cars} -->
165-
<!-- summary(cars) -->
166-
<!-- ``` -->
167-
168-
<!-- You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this. You could also use GitHub Actions to re-render `README.Rmd` every time you push. An example workflow can be found here: <https://github.com/r-lib/actions/tree/master/examples>. -->
169-
170-
<!-- You can also embed plots, for example: -->
171-
172-
<!-- ```{r pressure, echo = FALSE} -->
173-
<!-- plot(pressure) -->
174-
<!-- ``` -->
175-
176-
<!-- In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN. -->
1+
---
2+
output: github_document
3+
---
4+
5+
<!-- README.md is generated from README.Rmd. Please edit that file -->
6+
7+
```{r, include = FALSE}
8+
knitr::opts_chunk$set(
9+
collapse = TRUE,
10+
comment = "#>",
11+
fig.path = "man/figures/README-",
12+
out.width = "100%"
13+
)
14+
```
15+
16+
# gbm.auto
17+
18+
<!-- badges: start -->
19+
[![R-CMD-check](https://github.com/SimonDedman/gbm.auto/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/SimonDedman/gbm.auto/actions/workflows/R-CMD-check.yaml)
20+
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/gbm.auto)](https://cran.r-project.org/package=gbm.auto)
21+
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/gbm.auto)](https://cran.r-project.org/package=gbm.auto)
22+
<!-- badges: end -->
23+
<!-- badgeplacer(location = ".", status = "active", githubaccount = SimonDedman, githubrepo = gbm.auto, branch = master, name = "README.Rmd") -->
24+
25+
Automatically runs numerous processes from R packages 'gbm' and 'dismo' and script 'gbm.utils.R' which contains Elith et al.'s functions: roc, calibration, and gbm.predict.grids, as well as running my packages gbm.bfcheck, gbm.basemap, gbm.map, gbm.rsb, gbm.cons, gbm.valuemap, and gbm.loop.
26+
27+
Also see each script's Details section in the manual pages, as these frequently contain tips or common bugfixes.
28+
29+
I strongly recommend that you download papers 1 to 5 (or just the doctoral thesis) on <https://www.simondedman.com>, with emphasis on P4 (the guide) and P1 (statistical background). Elith et al 2008 (<https://besjournals.onlinelibrary.wiley.com/doi/10.1111/j.1365-2656.2008.01390.x>) is also strongly recommended. Also it's imperative you read the R help files for each function before you use them. In RStudio: Packages tab, scroll to gbm.auto, click its name, the click the function to see its man (manual) page. Read the whole thing. Function man pages can also be accessed from the console by typing
30+
31+
``` r
32+
?function
33+
```
34+
35+
Just because you CAN try every conceivable combination of tc, lr, bf, all, at once doesn't mean you should. Try a range of lr in shrinking orders of magnitude from 0.1 to 0.000001, find the best, THEN try tc c(2, n.expvars), find the best THEN bf c(0.5, 0.75, 0.9) and then in between if either outperform 0.5.
36+
37+
***
38+
39+
### gbm.auto
40+
41+
Automated Boosted Regression Tree modelling and mapping suite
42+
43+
Automates delta log normal boosted regression trees abundance prediction. Loops through all permutations of parameters provided (learning rate, tree complexity, bag fraction), chooses the best, then simplifies it. Generates line, dot and bar plots, and outputs these and the predictions and a report of all variables used, statistics for tests, variable interactions, predictors used and dropped, etc. If selected, generates predicted abundance maps, and Unrepresentativeness surfaces.
44+
45+
***
46+
47+
### gbm.bfcheck
48+
49+
Calculates minimum Bag Fraction size for gbm.auto
50+
51+
Provides minimum bag fractions for gbm.auto, preventing failure due to bf & samples rows limit.
52+
53+
***
54+
55+
### gbm.basemap
56+
57+
Creates Basemaps for Gbm.auto mapping from your data range
58+
59+
Downloads unzips crops & saves NOAAs global coastline shapefiles to user-set box. Use for 'shape' in gbm.map. If downloading in RStudio uncheck "Use secure download method for HTTP" in Tools > Global Options > Packages.
60+
61+
***
62+
63+
### gbm.map
64+
65+
Maps of predicted abundance from Boosted Regression Tree modelling
66+
67+
Generates maps from the outputs of gbm.step then gbm.predict.grids, handled automatically within gbm.auto but can be run alone, and generates representativeness surfaces from the output of gbm.rsb.
68+
69+
***
70+
71+
### gbm.rsb
72+
73+
Representativeness Surface Builder
74+
75+
Loops through explanatory variables comparing their histogram in 'samples' to their histogram in 'grids' to see how well the explanatory variable range in samples represents the range being predicted to in grids. Assigns a representativeness score per variable per site in grids, and takes the average score per site if there's more than 1 expvar. Saves this to a CSV; it's plotted by gbm.map if called in gbm.auto. This shows you which areas have the most and least representative coverage by samples, therefore where you can have the most/least confidence in the predictions from gbm.predict.grids.
76+
Can be called directly, and choosing a subset of expvars allows one to see their individual / collective representativeness.
77+
78+
***
79+
80+
### gbm.cons
81+
82+
Conservation Area Mapping
83+
84+
Runs gbm.auto for multiple subsets of the same overall dataset and scales the combined results, leading to maps which highlight areas of high conservation importance for multiple species in the same study area e.g. using juvenile and adult female subsets to locate candidate nursery grounds and spawning areas respectively.
85+
86+
***
87+
88+
### gbm.valuemap
89+
90+
Decision Support Tool that generates (Marine) Protected Area options using species predicted abundance maps
91+
92+
Scales response variable data, maps a user-defined explanatory variable to be avoided, e.g. fishing effort, combines them into a map showing areas to preferentially close. Bpa, the precautionary biomass required to protect the spawning stock, is used to calculate MPA size. MPA is then grown to add subsequent species starting from the most conservationally at-risk species, resulting in one MPA map per species, and a multicolour MPA map of all. All maps list the percentage of the avoid-variables total that is overlapped by the MPA in the map legend.
93+
94+
***
95+
96+
### gbm.loop
97+
98+
Calculate Coefficient Of Variation surfaces for gbm.auto predictions
99+
100+
Processes a user-specified number of loops through the same gbm.auto parameter combinations and calculates the Coefficient Of Variation in the predicted abundance scores for each site aka cell. This can be mapped to spatially demonstrate the output variance range.
101+
102+
***
103+
104+
### gbm.factorplot
105+
106+
ggplot-based update to PDP for factorial/categorical/character variables, allows changing order of categorical variables, and changing angle of x-axis labels to avoid them being cut off.
107+
108+
***
109+
110+
### lmplot
111+
112+
Linear plot of two variables.
113+
114+
***
115+
116+
### gbm.lmplots
117+
118+
Loops through lmplots for all expvars (x) against the same resvar (y).
119+
120+
***
121+
122+
### roc & calibration
123+
124+
Internal functions authored by Elith & Leathwick, used by gbm.auto.R
125+
126+
***
127+
128+
### gbm.step.sd
129+
130+
Local copy of dismo's gbm.step, with added functions to generate model evaluation metrics such as root mean squared error and amount of deviance explained relative to null.
131+
132+
***
133+
134+
## Installation
135+
136+
You can install the released version of gbm.auto from [CRAN](https://CRAN.R-project.org) with:
137+
138+
``` r
139+
install.packages("gbm.auto")
140+
```
141+
142+
And the development version from [GitHub](https://github.com/) with:
143+
144+
``` r
145+
# install.packages("devtools")
146+
remotes::install_github("SimonDedman/gbm.auto")
147+
```
148+
For linux installations, first install libraries which allow gdal, units, and s2 dependencies to install, with:
149+
150+
`sudo apt install libgdal-dev libudunits2-dev libabsl-dev`
151+
152+
***
153+
154+
## Example
155+
156+
(See each function's help file for specific examples, and the documents listed above)
157+
158+
***
159+
160+
## ToDo List
161+
162+
See GitHub issues section https://github.com/SimonDedman/gbm.auto/issues
163+
Feel free to contribute to this!
164+
165+
<!-- What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so: -->
166+
167+
<!-- ```{r cars} -->
168+
<!-- summary(cars) -->
169+
<!-- ``` -->
170+
171+
<!-- You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this. You could also use GitHub Actions to re-render `README.Rmd` every time you push. An example workflow can be found here: <https://github.com/r-lib/actions/tree/master/examples>. -->
172+
173+
<!-- You can also embed plots, for example: -->
174+
175+
<!-- ```{r pressure, echo = FALSE} -->
176+
<!-- plot(pressure) -->
177+
<!-- ``` -->
178+
179+
<!-- In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN. -->

0 commit comments

Comments
 (0)