Downloads · 30 days
0
hongducle96/vietnamese-name-gender-classification
vietnamese-name-gender-classification is a text classification model from hongducle96. Use it when you need a label for a piece of text. It is set up for sklearn. The card lists the license as apache-2.0.
Model name: vn-gender-name-classification Model type: Classical ML (TF-IDF + Logistic Regression + Linear SVM) Task: Gender classification from Vietnamese full names Author: Le Hong Duc - [email protected] - https…
Downloads · 30 days
0
Access
Public
Updated Dec 11, 2025
Repo size
619 KB
Likes
0
Public
Click a slice to open those files.
.joblib619 KB · 98%
From the Hugging Face model README
Model name: vn-gender-name-classification
Model type: Classical ML (TF-IDF + Logistic Regression + Linear SVM)
Task: Gender classification from Vietnamese full names
Author: Le Hong Duc - [email protected] - https://www.linkedin.com/in/hongduc96/
This model predicts binary gender (Nam / Nữ – male/female) from Vietnamese full names. It is trained on a dataset of Vietnamese names labeled with binary gender, using character n-gram TF-IDF features and two base models:
.joblibGiới tính ∈ {Nam, Nữ} (binary male/female)For each name:
name_wo_surname by:
"Nguyễn Hoàng Phúc" →
full_name_clean = "nguyễn hoàng phúc"name_wo_surname = "hoàng phúc"
Both forms are used for training to make the model more robust to how names are provided.On the held-out test set (~15K names), with results:
Confusion matrix (Nam/Nữ) – PROD:
| Actual \ Predicted | Nam | Nữ |
|---|---|---|
| Nam | 6401 | 236 |
| Nữ | 298 | 8111 |
395 / 15046 (2.63%)Both LR and SVM use the same character-level TF-IDF features:
TfidfVectorizer with:
analyzer="char_wb" (character n-grams within word boundaries)ngram_range=(2, 6) (bigrams to 6-grams)min_df=2 (ignore n-grams that appear in fewer than 2 documents)
This allows the model to learn patterns from substrings of names, which is very effective for Vietnamese given names.Two scikit-learn pipelines are trained:
model_lr.joblib
TfidfVectorizer → LogisticRegression(max_iter=1000, n_jobs=-1)predict_proba for probability estimates.model_svm.joblib
TfidfVectorizer → LinearSVCFor an input full name full_name_raw:
Preprocessing
full_name_clean = normalize_name_keep_accent(full_name_raw)name_wo_surname = drop_surname(full_name_clean)SVM predictions
SVM_FULL = model_svm.predict([full_name_clean])SVM_WO = model_svm.predict([name_wo_surname])LR combined probabilities
p_Nam_full, p_Nu_full = LR(full_name_clean)p_Nam_wo, p_Nu_wo = LR(name_wo_surname)p_Nam_avg = 0.5 * (p_Nam_full + p_Nam_wo)p_Nu_avg = 1.0 - p_Nam_avgLR_label = "Nam" if p_Nam_avg >= p_Nu_avg else "Nữ"LR_conf = max(p_Nam_avg, p_Nu_avg)Decision rule
SVM_FULL == SVM_WO (SVMs agree):
final_label = SVM_FULLLR_conf < lr_conf_clear (default 0.60).SVM_FULL != SVM_WO (SVMs disagree, hard case):
LR_conf >= lr_conf_as_referee (default 0.70), follow LR:final_label = LR_labelSVM_WO:final_label = SVM_WOfinal_label – production gender prediction ("Nam" or "Nữ")LR_conf – LR combined confidenceis_ambiguous – whether this name is considered ambiguous by the ensembleIntended use & limitations Intended use
Limitations
This model should not be used for high-stakes decisions that affect individual rights, access to services, or opportunities, or in any context where misclassification could cause harm or discrimination.