Nick Lertmethaphat

Work Case study 01

Sorting Thai job titles into occupation codes

A classifier turns hand-written Thai and English job titles into ISCO-08 occupation codes. Online postings can then be counted by occupation.

Type
Case study of a PIER Discussion Paper
Published
Authors
Nuttapol Lertmethaphat (first author), Nuarpear Lekfuangfu and Pucktada Treeratpituk
  1. 71%

    accuracy at the 4-digit level, in 5-fold cross-validation on Department of Employment records

    Source: PIER Discussion Paper No. 228, section 4.1

  2. 83%

    of titles had the right code among the model’s top 3 choices

    Source: PIER Discussion Paper No. 228, section 4.2

  3. more than 1.1 million

    job postings from 2 online job platforms coded, from the fourth quarter of 2020 to the third quarter of 2023

    Source: PIER Discussion Paper No. 228, section 5.2

01 Question

Without a consistent, representative vacancy series for the whole labor market, Thailand could not build a reliable Beveridge curve. The curve pairs unemployment with vacancies. The paper describes it as a central framework for labor market analysis in academic research and at central banks.

Unemployment comes from the monthly Labour Force Survey. Vacancies had no equivalent. The Surveys of Labour Demand were irregular and covered only selected manufacturing establishments. Online job platforms post daily and in real time. Yet each job title is written by hand, in Thai or in English. Thus, postings cannot be counted by occupation until the titles are standardized into the International Standard Classification of Occupations (ISCO-08).

02 My role

I am the first author of the paper that reports this classifier. My co-authors are Nuarpear Lekfuangfu and Pucktada Treeratpituk. Nuarpear Lekfuangfu is the corresponding author and acknowledges support from PIER research grant 2022/2.

03 Data and scale

Training data come from the job-posting archive of Thailand’s Department of Employment (DOE). It contains hundreds of thousands of hand-written records. Each record pairs a job title with an ISCO code. DOE staff in different regional offices assigned the 4-digit codes by hand.

The ISCO-08 handbook adds formal descriptions of 415 unit groups. ISCO-08, the occupation classification of the International Labour Organization, has 436 unit groups. Major group 0 holds 3 of them and major group 6 holds 18. The study excludes both groups. Thus, 415 unit groups remain.

After training, the model was applied to more than 1.1 million job postings from 2 online job platforms. The postings cover the fourth quarter of 2020 to the third quarter of 2023.

04 Method

The steps below are reconstructed from sections 2.4 and 3 of the paper. The paper does not number them.

Top-1 accuracy counts a title as right when the model’s first choice is the correct code. Top-3 accuracy counts it as right when the correct code is among the first 3 choices.

Every title

  1. 1CleanTidy the text of the job title.
  2. 2TranslateThai titles go into English.
  3. 3EmbedTurn the title into numbers that carry its meaning (Universal Sentence Encoder).

Training only

  1. 4Repair labelsMajority rule, then close match.
  2. 5Compare6 models, 5-fold cross-validation.
  3. 6Keep XGBoostThe model with the highest accuracy assigns the 4-digit code.

Tested and dropped A compact language model (Phi-3) re-checked the top 3 codes. Top-1 accuracy fell from 71% to 64%.

Fig. 1: From a hand-written title to a 4-digit ISCO-08 code. The Phi-3 re-check was tested and dropped. Source: PIER Discussion Paper No. 228, sections 2.4, 3 and 4.2.

Preparing every title, in training and on a new title:

  1. Clean the text of each job title.
  2. Translate Thai titles into English. The choice rests on a 3-stage cosine similarity test on selected job-title pairs. In that test, the embedding model in step 3 scored higher on English text. The paper names no translation tool and does not measure translation error.
  3. Turn each title into a list of numbers that captures its meaning (a sentence embedding, here the Universal Sentence Encoder). WangchanBERTa, a Thai language model, was tested. The Universal Sentence Encoder was chosen.

Training only:

  1. Repair the training labels in 2 phases. The majority rule keeps the code that clearly dominates for a title. If the cosine similarity passes a tuned threshold, the close-match step gives each remaining title the code of its closest cleaned title.
  2. Train 6 models and compare them with 5-fold cross-validation. The data are split into 5 parts, and each part is held out once.
  3. Keep the model with the highest accuracy: XGBoost, a set of small decision trees. Each tree corrects the errors of the one before.

On a new title, the title goes through steps 1 to 3, and the XGBoost model assigns the code.

The paper does not report the similarity threshold, the training size after repair, the hyperparameters, the run time or the Phi-3 prompt.

05 Evaluation

Each model was scored on accuracy with 5-fold cross-validation on DOE records with repaired labels. The paper chose accuracy because precision and recall for each of 415 categories would be impractical to analyze.

At the 4-digit level, XGBoost reached 71%, random forest 66% and the neural network 65%. The 2 cosine similarity classifiers fell from about 48% at the 1-digit level to about 25% at the 4-digit level. BERTopic fell from 24% to 13%.

Accuracy at the 4-digit ISCO level by model, percent
ModelAccuracy
XGBoost 71%
Random forest 66%
Neural network 65%
Cosine similarity about 25%
Hierarchical cosine similarity about 25%
BERTopic 13%
Fig. 2: Accuracy at the 4-digit ISCO level for 6 models, 5-fold cross-validation on DOE records. XGBoost scored highest. Source: PIER Discussion Paper No. 228, section 4.1.

For XGBoost, top-3 accuracy was 83%. A compact language model (Phi-3) was then asked to choose among those 3 codes. Top-1 accuracy fell to 64%. Thus, the final model uses XGBoost alone.

XGBoost accuracy with and without the language model re-check, percent
SetupAccuracy
XGBoost, top 1 71%
XGBoost, right code in top 3 83%
Top 1 after the Phi-3 re-check tested and dropped 64%
Fig. 3: XGBoost listed the right code in its top 3 for 83% of titles. Phi-3 re-ranking lowered top-1 accuracy to 64%. Source: PIER Discussion Paper No. 228, section 4.2.

The paper reports no accuracy for online postings. The model was applied to those postings.

06 Limits

  • The Universal Sentence Encoder is a general-purpose model, and it may miss Thai labor market terms.
  • DOE postings are more formal than scraped online postings. This could affect accuracy in use.
  • Agriculture and public-sector jobs are rare in both sources.
  • ISCO labels limit how well the model can recognize emerging jobs such as green jobs.
  • Some neighbors are confused: 24% of elementary occupations (group 9) were predicted as service and sales workers (group 5). The paper says this may stem from inconsistent codes in the training labels. It could also be an error of the model. No human-coded sample tests either reading.

This page reports published aggregates and shows no row-level records.

07 Output

The classifier assigns a 4-digit ISCO-08 code to a hand-written Thai or English job title. Discussion Paper No. 232 refers to this paper for how its job titles were standardized, and it reports labor market tightness by 1-digit ISCO group.