Skip to content

Sequencing semiconductor work orders with Random Forest

My master’s research in brief: 4 million production rows, three models compared, and how it went into use.

Published

BuildAnalyseDeploy and useProduction data2 yearsPrepare datafilter, encodeTrain 3 modelsRF, HGB, LRChooseRandom ForestSchedulerAPIShop floorsequence ordersReal results from the floor become the next training data

My master's research began with a problem I saw every day in a semiconductor plant: work orders were assigned to machines without matching each machine's capacity, causing bottlenecks, long waits, and some machines idle while others overflowed. The research question was simple: if we could predict in advance which step each work order would reach and how long it would take, how much better could we sequence the work?

This article walks through the whole approach in three phases, build, analyse, and deploy for real use, as in the drawing above.

Phase 1, build: from raw data to a usable dataset

The data came from two years of the production system's PostgreSQL database: 17,953,082 rows at the start, 4,052,934 after filtering, split into 2,837,053 training rows and 1,215,881 test rows.

Step What was done Why
Filter Remove incomplete or abnormal rows Wrong data teaches the model wrong things
Encode Label Encoding from text to numbers Models accept numbers only
Scale Bring each column into the same range Large-valued columns should not dominate
Split 70% training, 30% test Test on data the model has never seen

All of this runs as an automated 15-step pipeline, from loading settings and querying data through cleaning, parallel training and evaluation to saving and deploying the model, so it can be re-run whenever new data arrives.

The automated 15-step model pipeline

Figure: the 15-step pipeline for building and deploying the model. Source: the author (2025).

Phase 2, analyse: a fair comparison of three models

I chose three models suited to tabular data and measured them with the same metrics. Accuracy alone is not enough, because production data is imbalanced: some steps are common and some rare, so macro-averaged F1 tells the truth better.

Type A (common): 95Type B (rare): 5A model that always says AAccuracy 95%yet finds no B at allF1 (B) = 0So always read macro F1 alongside accuracy
Random Forest99.97%F1 98.9%Hist Gradient Boosting96.65%F1 77.46%Logistic Regression79.62%F1 24.19%colour = accuracy, grey = macro F1
Model Accuracy Precision Recall F1
Random Forest 99.97% 98.99% 98.81% 98.90%
Hist Gradient Boosting 96.65% 78.51% 76.69% 77.46%
Logistic Regression 79.62% 83.23% 23.70% 24.19%

Performance and run time of the three models

Figure: metrics and run time compared. Source: the author (2025).

How to read it. Logistic Regression looks fine at 79.62% accuracy, but its F1 is only 24.19%: it is right mostly on the common classes. Random Forest scores high on both accuracy and F1, with a cross-validated mean of 99.96% and a standard deviation of just 0.0000346, so results are stable across every split. The trade-off is a longer training time than Hist Gradient Boosting, which is acceptable because training runs outside working hours.

Why Random Forest. Production data is non-linear and imbalanced. Hundreds of decision trees voting together handle that well, tolerate outliers, and can explain which features matter, which is essential when talking with engineers on the floor.

Phase 3, deploy: put it where people work

The best model is saved to a file and exposed through a Scheduler API running on Linux and Docker. The planning system sends work-order data and gets predictions back, and an Android app keeps working without signal.

SchedulerOrders waiting (sequenced by AI)1Order AMachine 32Order BMachine 13Order CMachine 44Order DMachine 25Order EMachine 6Machines runningMachine 1RunMachine 2RunMachine 3RunMachine 4RunMachine 5RunMachine 6RunConcept drawing, not a real screen or data

The sequencing screen shows waiting orders ranked by the model next to the machines currently running. The planner still makes the final call, and whenever the real result differs from the prediction, that data goes back into the next training round.

The approach I want to share

  1. Start from a measurable problem on the floor, not from an algorithm you want to try.
  2. Use the data the factory already has. Two years of production history is worth more than it looks.
  3. Measure fully, especially with imbalanced data, where accuracy alone misleads.
  4. Make it re-runnable and automatic, so it can be retrained when the line changes.
  5. Deliver it inside the systems people already use, through an API, with people making the final decision.

A caution: accuracy this high reflects a fairly stable process. When products change or machines are added, watch the accuracy and retrain regularly. Company details are confidential, so the screen in this article is a concept drawing.

References

Boonnuk, P., & Romsaiyud, W. (2027). Predictive work order management for semiconductor manufacturing processes using the random forest algorithm [in Thai]. KMUTNB Journal of Information Technology, 23(1). (Accepted for publication)

Talk about a role