detect_sdg | R Documentation |
detect_sdg
identifies SDGs in text using an ensemble model approach considering multiple existing SDG query systems and text length.
detect_sdg(
text,
systems = lifecycle::deprecated(),
output = lifecycle::deprecated(),
sdgs = 1:17,
synthetic = c("equal"),
verbose = TRUE
)
text |
|
systems |
As of text2sdg 1.0.0 the 'systems' argument of 'detect_sdg()' is deprecated. This is because 'detect_sdg()' now makes use of an ensemble approach that draws on all systems as well as on the text length, see –preprint– for more information. The old version of 'detect_sdg()' is available through the 'detect_sdg_systems()' function. |
output |
As of text2sdg 1.0.0 the 'output' argument of 'detect_sdg()' is deprecated. This is because 'detect_sdg()' now makes use of an ensemble approach that draws on all systems as well as on the text length, see –preprint– for more information. The old version of 'detect_sdg()' is available through the 'detect_sdg_systems()' function. |
sdgs |
|
synthetic |
|
verbose |
|
detect_sdg
implements a ensemble model to detect SDGs in text. The ensemble model combines the six systems implemented by detect_sdg_systems
and text length in a random forest architecture. The ensemble model has been trained on three data sets with SDG labels assigned by experts and a matching number of synthetic texts generated by random sampling from a word frequency list. The user has the choice of multiple versions of the ensemble model that have been trained on different amounts of synthetic texts to adjust the sensitivity and specificity of the model. Increasing the amount of of synthetic data makes the ensemble more conservative, leading to increased sensitivity and decreased specificity.
By default, detect_sdg
implements the version of the ensemble model that has been trained on an equal amount of expert-labeled and synthetic data, providing a reasonable balance between sensitivity and specificity. For details, see article by Wulff et al. (2023).
The function returns a tibble
containing the SDG hits found in the vector of documents. The columns of the tibble
are described below. The tibble
also includes as an attribute with name "system_hits"
the predictions of the individual systems produced by detect_sdg_systems()
.
Index of the element in text
where match was found. Formatted as a factor with the number of levels matching the original number of documents.
Label of the SDG found in document.
The name of the ensemble system that produced the match.
Index of hit for the Ensemble model.
Wulff, D. U., Meier, D., & Mata, R. (2023). Using novel data and ensemble models to improve automated SDG-labeling. arXiv
# run sdg detection
hits <- detect_sdg(projects)
# run sdg detection for sdg 3 only
hits <- detect_sdg(projects, sdgs = 3)
# extract systems hits
attr(hits, "system_hits")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.