Skip to content

Commit

Permalink
include traditional fads into fads + update results
Browse files Browse the repository at this point in the history
  • Loading branch information
langbart committed Feb 13, 2024
1 parent 578480f commit 528009c
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 17 deletions.
Binary file modified .DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions data-raw/get-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ kobo_trips <-
~ sum(.x) / 1000
)
) %>%
dplyr::ungroup()
dplyr::ungroup() %>%
dplyr::mutate(habitat = ifelse(habitat == "Traditional FAD", "FAD", habitat))

catch_data <-
trips %>%
Expand Down Expand Up @@ -139,7 +140,7 @@ data_list <- get_model_data()$data_processed
model_outputs <-
purrr::imap(
data_list, ~ run_xgmodel
(dataframe = .x$dataframe, step_other = .x$step_other, n_cores = 8)
(dataframe = .x$dataframe, step_other = .x$step_other, n_cores = 7)
) %>%
setNames(paste0("model_", names(.)))

Expand Down
Binary file modified data/kobo_trips.rda
Binary file not shown.
Binary file modified data/model_outputs.rda
Binary file not shown.
Binary file modified data/shap_results.rda
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/highlight.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ <h1>
<div id="header">
<h1 class="title">Modelling scenarios for nutrient-sensitive fisheries management</h1>
<p class="author"><em>Lorenzo Longobardi</em></p>
<p class="date"><em>Last update: 2024-02-05</em></p>
<p class="date"><em>Last update: 2024-02-13</em></p>
</div>
<div id="content" class="section level1 hasAnchor" number="1">
<h1><span class="header-section-number">1</span> Content<a href="index.html#content" class="anchor-section" aria-label="Anchor link to header"></a></h1>
Expand Down
16 changes: 8 additions & 8 deletions docs/profiles.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/search_index.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs_book/04-profiles.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ Table 5.2: Performance Metrics for XGBoost Model Across Fishing Data Subsets. Th

The analysis of SHAP values (see [ML model explanation][In simple terms]) from gill net models (Figure 5.4, A-B), illuminates the influence of how the mesh size and habitat collectively determine the nutritional profiles in the Atauro (panel A) and Mainland (panel B). In Atauro, mesh sizes smaller than 40 mm are significantly associated with a higher likelihood of predicting the nutritional profile NP-2 across diverse habitats, including reefs, deep habitats, and to a lesser extent, Fish Aggregating Devices (FADs). Furthermore, these smaller mesh sizes exhibit a reduced association with nutritional profile NP-3, particularly when utilized within mangrove environments, and with NP-1 in beach and deep habitat settings. Conversely, mesh sizes around 50 mm are predominantly linked with nutritional profile NP-3, mainly within reef and FAD environments.
As the analysis extends to larger mesh sizes, those measuring 60 and 80 mm show a strong correlation with nutritional profiles NP-4 and NP-5, respectively, especially when fishing occurs across reefs and seagrass areas, with a minor association observed in beach environments for the 80 mm mesh size. This includes a modest connection to NP-1, notably when fishing takes place in deep areas. For mesh sizes exceeding 80 mm, the data indicates a notable shift, with nutritional profile NP-1 becoming the most prevalent prediction among the various profiles, particularly when fishing in reef and mangrove habitats.
Upon evaluating SHAP values derived from Mainland data, a more diverse pattern of associations emerges. Mesh sizes smaller than 30 mm, employed in beach, reef, and mangrove settings, are linked with nutritional profile NP-2, with a similar association observed in deep habitats. Meshes ranging from 30 to 40 mm are strong indicators of nutritional profile NP-1 across a broad spectrum of environments, especially in deep and reef areas. Increasing the mesh size to between 40 and 70 mm shifts the likelihood towards nutritional profile NP-5 as the most probable outcome for various fishing grounds, including reefs, deep environments, mangroves, and beaches. At the larger end of the spectrum, mesh sizes above 70 mm are more likely to predict nutritional profile NP-3, particularly in deep and FAD environments where SHAP values are notably high, with reefs, mangroves, and beaches also displaying relatively high values, and a noted increase in the likelihood of NP-3 outcomes in traditional FAD grounds when using a 100 mm mesh size.
Upon evaluating SHAP values derived from Mainland data, a more diverse pattern of associations emerges. Mesh sizes smaller than 30 mm, employed in beach, reef, and mangrove settings, are linked with nutritional profile NP-2, with a similar association observed in deep habitats. Meshes ranging from 30 to 40 mm are strong indicators of nutritional profile NP-1 across a broad spectrum of environments, especially in deep and reef areas. Increasing the mesh size to between 40 and 70 mm shifts the likelihood towards nutritional profile NP-5 as the most probable outcome for various fishing grounds, including reefs, deep environments, mangroves, and beaches. At the larger end of the spectrum, mesh sizes above 70 mm are more likely to predict nutritional profile NP-3, particularly in deep and FAD environments where SHAP values are notably high, with reefs, mangroves, and beaches also displaying relatively high values, and a noted increase in the likelihood of NP-3 outcomes in FAD grounds when using a 100 and 130 mm mesh sizes.
The SHAP value analysis for all fishing gear types other than gill nets reveals the complex interplay between the habitat where fishing occurs, the type of gear used, and whether the boats are motorised or unmotorised (Figure 5.4, panels C and D). In the Atauro dataset, as shown in panel C, the nutritional profile NP-1 is commonly associated with the use of long lines in deep water habitats, particularly from unmotorised boats. Hand lines in the same deep water habitats, however, shift the prediction towards nutritional profile NP-2. For nutritional profile NP-4, seine nets emerge as the most likely gear to yield this outcome in deep environments, though the use of hand lines also contributes to a lesser degree. Profiles NP-3 and NP-5 display a similarity in that they are both frequently predicted when fishing with spear guns; the former is more associated with unmotorised boats and the latter with motorised vessels. These two profiles are also set apart by their wider spread across various habitats that are connected to coastal areas, in contrast to the other profiles which are predominantly linked with deeper waters.
In Mainland, the application of cast nets in reef habitats shows a strong link to nutritional profile NP-1. In both FAD and traditional FAD settings, nutritional profile NP-2 emerges as the most common outcome regardless of the gear type employed, with the notable exception of long lines, which instead suggest a higher likelihood of resulting in profile NP-3. The profiles NP-4 and NP-5 are distinctively aligned with certain fishing practices: NP-4 is closely associated with the use of hand lines in deep habitats, and NP-5 is characteristic of spear fishing and manual collection in littoral zones such as reefs and beaches.
In Mainland, the application of cast nets in reef habitats shows a strong link to nutritional profile NP-1. In FAD settings, nutritional profile NP-2 emerges as the most common outcome regardless of the gear type employed, with the notable exception of long lines, which instead suggest a higher likelihood of resulting in profile NP-3. The profiles NP-4 and NP-5 are distinctively aligned with certain fishing practices: NP-4 is closely associated with the use of hand lines in deep habitats, and NP-5 is characteristic of manual collection and spearfishing in littoral zones such as reefs and beaches.



```{r eval=FALSE, fig.cap="Differential influence of mesh size on nutritional profile predictions across habitats. The figure compiles subplots for five distinct nutritional profiles (NP1-NP5) as predicted by gill net XGBoost models", fig.height=7, fig.width=8, message=FALSE, warning=FALSE, include=FALSE}
Expand Down Expand Up @@ -412,7 +413,7 @@ final_plot
```


```{r echo=FALSE, fig.cap="Differential influence of mesh size and habitat x gear type interaction on the nutritional profile predictions in Atauro (A and C) and in Mainland (B and D). Panels A-B: These panels elucidate the impact of mesh size on the probability of observing various nutritional profiles in Atauro (Panel A) and Mainland (Panel B). Each panel includes five plots corresponding to distinct nutritional profiles (NP1-NP5), as forecasted by gill net XGBoost models. The plots exhibit distributions of SHAP values over a range of mesh sizes. Each data point is color-coded to represent different habitats (Beach, Deep, FAD, Mangrove, Reef, Seagrass, and Traditional FAD), clarifying the mesh size's influence on the accuracy of predictions within each habitat. The y-axis details mesh size ranges, while the x-axis measures SHAP values, where higher values signal a stronger likelihood of a particular nutritional profile's presence. The size and opacity of each point are proportionate to the SHAP value's magnitude, visually indicating the significance of each data point in influencing the model's predictions. Panels C-D: In these panels, the interplay among habitat, gear type, and vessel type (motorized or unmotorized) is analyzed in relation to nutritional profiles in Atauro (Panel C) and Mainland (Panel D). Each plot showcases SHAP value distributions for the five nutritional profiles (NP1-NP5) predicted by XGBoost models applied to datasets encompassing all gear types, excluding gill nets. Data points are color-coded to differentiate between motorized and unmotorized vessels, shedding light on how vessel type, alongside habitat and gear interactions, modulates nutritional profile predictions. Echoing Panels A-B, elevated SHAP values on the x-axis indicate a heightened probability of a specific nutritional profile. Concurrently, the points' size and opacity correspond to the SHAP values, denoting their relative impact on the outcome prediction.", fig.height=9, fig.width=10, message=FALSE, warning=FALSE}
```{r echo=FALSE, fig.cap="Differential influence of mesh size and habitat x gear type interaction on the nutritional profile predictions in Atauro (A and C) and in Mainland (B and D). Panels A-B: These panels elucidate the impact of mesh size on the probability of observing various nutritional profiles in Atauro (Panel A) and Mainland (Panel B). Each panel includes five plots corresponding to distinct nutritional profiles (NP1-NP5), as forecasted by gill net XGBoost models. The plots exhibit distributions of SHAP values over a range of mesh sizes. Each data point is color-coded to represent different habitats (Beach, Deep, FAD, Mangrove, Reef and Seagrass), clarifying the mesh size's influence on the accuracy of predictions within each habitat. The y-axis details mesh size ranges, while the x-axis measures SHAP values, where higher values signal a stronger likelihood of a particular nutritional profile's presence. The size and opacity of each point are proportionate to the SHAP value's magnitude, visually indicating the significance of each data point in influencing the model's predictions. Panels C-D: In these panels, the interplay among habitat, gear type, and vessel type (motorized or unmotorized) is analyzed in relation to nutritional profiles in Atauro (Panel C) and Mainland (Panel D). Each plot showcases SHAP value distributions for the five nutritional profiles (NP1-NP5) predicted by XGBoost models applied to datasets encompassing all gear types, excluding gill nets. Data points are color-coded to differentiate between motorized and unmotorized vessels, shedding light on how vessel type, alongside habitat and gear interactions, modulates nutritional profile predictions. Echoing Panels A-B, elevated SHAP values on the x-axis indicate a heightened probability of a specific nutritional profile. Concurrently, the points' size and opacity correspond to the SHAP values, denoting their relative impact on the outcome prediction.", fig.height=9, fig.width=10, message=FALSE, warning=FALSE}

sha_Agn <- shapviz::shapviz(timor.nutrients::shap_results$model_atauro_GN)
sha_Mgn <- shapviz::shapviz(timor.nutrients::shap_results$model_timor_GN)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 528009c

Please sign in to comment.