Predicts ethnicity from last names, using self-trained model with customized labels. This is designed for advanced users who wish to use their own models. For most use cases, use [predict_ethnicity()] for prediction.

predict_lastname(
  lastnames,
  na.rm = FALSE,
  threads = 0L,
  labels = NULL,
  model_path = NULL
)

Arguments

lastnames

character vector, last names

na.rm

bool, default to FALSE, whether to remove the na in the `lastnames`

threads

int, number of threads for multi-threading

labels

character vector, labels of the classification model, needs to be in the same order as the trained model

model_path

character file path, the path to the trained model in .json format (converted from Keras by frugally-deep)

Value

data.frame with predicted probability and predicted ethnicity