View source: R/get_gender_nn.R
| get_gender_nn | R Documentation |
get_gender_nn uses a 2-layer bidirectional GRU neural network with
attention pooling to predict gender from Brazilian first names. Unlike
get_gender, this function can generalise to names not present
in the IBGE census dataset.
get_gender_nn(
names,
prob = FALSE,
threshold = 0.9,
nn_size = NULL,
device = NULL,
encoding = "ASCII//TRANSLIT"
)
names |
A character vector specifying a person's first name. Names can
also be passed to the function as a full name (e.g., Ana Maria de Souza).
|
prob |
Report the proportion of female uses of the name? Defaults to
|
threshold |
Numeric indicating the threshold used in predictions.
Defaults to 0.9. A single value sets the same threshold for both sexes; a
vector with two values sets one threshold per sex, the first for females and
the second for males (e.g., |
nn_size |
Batch size for neural network inference. When |
device |
Device used for inference. When |
encoding |
(Deprecated) Previously used to strip accents via
|
Model weights and vocabulary must be downloaded before first use with
download_gender_model. If the files are not found in an
interactive session, you will be prompted to download them. Subsequent
calls within the same session use an in-memory cache.
get_gender_nn may return three different values:
Female, if the name provided is female; Male, if the name
provided is male; or NA, if we can not predict gender from the
name given the chosen threshold.
If the prob argument is set to TRUE, then the function
returns the proportion of females uses of the provided name.
get_gender, download_gender_model
## Not run:
get_gender_nn("Maria")
get_gender_nn(c("Maria", "Joao"), prob = TRUE)
get_gender_nn("Ana Maria de Souza")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.