Support Vector Machine (SVM)
A classification method that finds a decision boundary between groups while making the gap to the nearest data points as wide as possible.
Can you tell whether a semiconductor wafer is defective from its sensor readings alone? If temperature and vibration are both in the normal range but their combination is abnormal, how do you tell the difference? And when the readings for normal and defective wafers overlap, what kind of boundary should you look for?
In cases like these, the method that learns a boundary separating data based on several measurements is the support vector machine (SVM). An SVM considers not only the boundary that separates the groups but also the gap between that boundary and the observations closest to it, which is called the margin.
Logistic regression models the probability of group membership as a function of the input variables, whereas an SVM mainly optimizes the classification boundary and the margin. A linear SVM separates groups with a straight line or a plane, and a kernel SVM can also learn complex curved boundaries.
SVMs are used in manufacturing quality inspection, text and image classification, bioinformatics, detecting abnormal patterns and more. In this article we’ll use sensor readings from semiconductor wafers to cover the concept and training principle of SVMs, margins and kernels, real classification results, hyperparameter settings, how SVMs differ from other analyses and what to watch out for.
What is an SVM?
A supervised learning method that considers both the boundary separating two groups and the gap around it.
An SVM uses training data with known labels. For example, it learns from the sensor data of wafers whose inspection results were confirmed as normal or defective, then predicts which group a new wafer belongs to. If the groups can be separated by a straight line, you can consider a linear SVM; if the relationship is complex, you can consider an SVM with a kernel.
The goal here is not to divide all the training data perfectly no matter what. It is to find, while allowing some misclassification, a stable classification boundary that will also hold up on new data.
Why do we need SVMs?
To separate groups stably by also taking into account the observations near the boundary.
Temperature alone may not separate normal from defective wafers, and a single vibration reading may not make the split clear either. But when you look at the two sensor values together, normal and defective wafers may cluster in different regions. An SVM uses combinations of several variables to learn a boundary like this.
It can be a particularly useful option when there are many variables or the pattern that separates the groups is not simple. But an SVM is not always more accurate than other classification methods. Performance depends on the scale of the variables, the hyperparameters, the size of the data and the defect rate.
How does an SVM work?
The decision boundary, the margin and the support vectors are the key ideas.
① Find the decision boundary
In the space formed by the sensor variables, find the line or surface that separates normal from defective. With 2 variables it is a line, with 3 a plane, and with more a hyperplane.
② Make the margin wide
The SVM tries to widen the gap to the training observations closest to the boundary. It uses a soft margin, though, which allows some observations to be misclassified or to fall inside the margin.
③ Support vectors shape the boundary
The observations directly involved in determining the optimal boundary are called support vectors. Not every observation determines the boundary equally.
④ Handle nonlinear relationships with kernels
With a kernel such as RBF, the SVM can use similarities between inputs to create a nonlinear decision boundary in the original variable space. An overly complex boundary can lead to overfitting, however.
Worked example: classifying defective semiconductor wafers
Classifying wafers as normal or defective from manufacturing-process sensor readings.
We use 500 hypothetical wafers inspected in the process: 450 normal and 50 defective, a defect rate of 10%. Assume each wafer has recorded temperature, pressure, vibration and current readings, and that its true label was confirmed by a separate quality inspection.
| Variable | Example data | Role |
|---|---|---|
| Final inspection result | Normal / defective | Target to classify |
| Process temperature | °C | Predictor |
| Chamber pressure | kPa | Predictor |
| Vibration magnitude | mm/s | Predictor |
| Current | A | Predictor |
| Number of records | 500 wafers (50 defective) | Hypothetical training and test data |
We split off 400 wafers, 80% of the data, as training data and keep the remaining 100 as the final test data. Assuming a stratified split that preserves the defect rate, the test data consist of 90 normal and 10 defective wafers. The figures presented from here on are hypothetical results for illustration and were not obtained by actually running an SVM.
What do you check before applying an SVM?
Check the scale of the variables, the defect rate and the possibility of data leakage.
| Check item | What to check | Why it matters |
|---|---|---|
| Sensor value ranges | Units and scales of temperature, pressure and current | Affects distance and kernel calculations |
| Class proportions | 90% normal, 10% defective | Evaluating on accuracy alone is risky |
| Missing values and outliers | Sensor errors, missing readings | Affects the boundary and scaling |
| Data leakage | Whether values only known after quality inspection are included | Prevents overestimating real predictive performance |
| Same production lot | Whether lots overlap between training and test data | Important for independent evaluation |
| Future operating conditions | Sensor distributions after process changes or with new equipment | Possible drop in on-site performance |
What are the steps in an SVM analysis?
From splitting the data through choosing the kernel and hyperparameters to the final evaluation.
① Specify the target and the input variables
Set normal/defective as the target and use only sensor values that are available before the actual inspection.
② Split the training and test data
Split off the final test data first, and run cross-validation only within the training data. Sensor standardization is likewise fitted only on the training part of each validation fold.
③ Choose the kernel and C and gamma
Compare a linear kernel with an RBF kernel, and tune C and, for RBF, gamma by cross-validation. If missing a defect is costly, decide on a matching evaluation criterion in advance.
④ Check performance on the test data
Apply the chosen model to the separate test data and check the confusion matrix, precision, recall, F1 score and so on. Do not reuse the test data repeatedly to pick the model again.
What do C and gamma control?
They control how much margin violation is allowed and how complex the decision boundary is.
| Setting | Smaller value | Larger value |
|---|---|---|
| C | Smaller penalty for margin violations, so stronger regularization | Margin violations are penalized more heavily, so a more complex boundary can be chosen |
| gamma (RBF) | Each data point’s range of influence becomes wider | Range of influence narrows, so the boundary can become more detailed |
There is no combination of C and gamma that is always optimal. For example, when both C and gamma are large, the model can follow even small fluctuations in the training data, and validation performance can drop. These values should be chosen by cross-validation on standardized data.
How do you interpret the classification results?
Check how many defects are missed and how well they are found.
Suppose we classified the 100 hypothetical final test wafers with an RBF SVM. Of the 90 normal wafers, 82 were classified as normal and 8 were wrongly flagged as defective. Of the 10 defective wafers, 8 were caught and 2 were missed.
| Actual \ Predicted | Normal | Defective | Total |
|---|---|---|---|
| Normal | 82 | 8 | 90 |
| Defective | 2 | 8 | 10 |
| Total | 84 | 16 | 100 |
Here accuracy is 90.0% (90/100), defect recall is 80.0% (8/10), and defect precision is 50.0% (8/16). The F1 score is about 61.5%. Because 2 of the 10 defective wafers are missed, a 90% accuracy alone does not mean the performance is good enough for quality inspection.
How do you compare SVM performance?
Look at linear and nonlinear boundaries using the same evaluation criteria.
| Hypothetical metric | Linear SVM | RBF SVM |
|---|---|---|
| Cross-validated defect F1 | 55.0% | 62.0% |
| Final test accuracy | 88.0% | 90.0% |
| Final test defect recall | 70.0% | 80.0% |
| Final test defect precision | 43.8% | 50.0% |
In this example, assume the RBF SVM was chosen because it had the higher F1 score in cross-validation within the training data. The final test scores are values checked independently after that choice. In practice you should also look at the variability of the cross-validation scores and the uncertainty caused by the small number of defective samples.
An SVM’s basic decision function score is related to how far an observation is from the classification boundary, but it is not itself a probability of being defective. If a decision requires probabilities, you need separate probability calibration and an evaluation of calibration performance.
What to watch out for with SVMs
Even when the performance figures are high, check which defects are being missed in practice.
Did you standardize the variables?
Fit the standardization on the training data so that sensor values with large units don’t dominate the distance calculations.
Are you looking only at accuracy when defects are rare?
In an example where defects are 10% of the total, predicting that everything is normal still gives 90% accuracy. Check defect recall and precision together with the cost of missing a defect.
Did you tune hyperparameters on the test data?
If you keep picking the combination that scores well on the final test data, the evaluation results can become optimistic. Finish tuning with cross-validation within the training data.
Did you take lot and equipment differences into account?
If wafers from the same production batch end up in both training and test data, the evaluation can be easier than predicting a genuinely new batch. Consider splitting by time, lot or equipment to match how the model will be used.
Did you confuse explanation with causation?
The fact that an SVM uses a particular sensor value for classification does not mean that sensor value causes defects. Patterns used for prediction must be kept separate from root-cause analysis.
How does it differ from other analyses?
The goal of classifying groups may be the same, but the way the boundary is learned differs.
| Method | How it classifies | What sets it apart |
|---|---|---|
| SVM | Optimizes the decision boundary with the margin in mind | Can handle nonlinear relationships with kernels |
| Logistic regression | Models the log-odds of group membership | Coefficients and odds ratios are relatively easy to interpret |
| Discriminant analysis (LDA/QDA) | Uses assumptions about each group’s distribution and covariance | Computes probabilities and boundaries under distributional assumptions |
| KNN | Classifies by the majority label of nearby data | Sensitive to distance, K and scale |
| Decision tree | Builds splitting rules based on variable values | Rules are relatively easy to interpret |
A distinctive feature of SVMs is that they focus on the observations at the boundary. But they are not always superior on small datasets, and using a kernel does not always improve performance. It’s important to compare methods using the same data split and the same evaluation metrics.
How do you report SVM results?
Present the classification setup, the performance evaluation procedure and the types of errors together.
The results should give the size of the data and the class proportions, the input sensor variables, the training/test split, the preprocessing, the kernel, how C and gamma were chosen, the cross-validation criterion, and the confusion matrix and performance metrics on the independent test data. Limits on generalizing to other processes or new batches should also be explained.
A support vector machine (SVM) was applied to classify semiconductor wafers as normal or defective using process sensor readings. Of 500 hypothetical wafers, 400 were used as training data and 100 as final test data, and an RBF kernel model was selected by cross-validation within the training data. On the final test data, accuracy was 90.0%, defect recall was 80.0%, precision was 50.0% and the F1 score was about 61.5%. Two of the 10 defective wafers were misclassified as normal. The figures presented are a hypothetical example for learning purposes.
In a real report, you should state clearly whether the classification threshold was changed, which errors matter more in the operating environment, and whether model selection was kept separate from the final test data.
Where can SVMs be used?
In situations where groups are distinguished by many features, such as sensors, images or text.
| Field | What is classified | Variables that can be used |
|---|---|---|
| Semiconductor manufacturing | Normal vs. defective wafers | Temperature, pressure, vibration, current |
| Equipment maintenance | Normal vs. abnormal states | Sensor signals, vibration frequencies |
| Text analysis | Spam vs. legitimate email | Word frequencies, sentence features |
| Bioinformatics | Patient group vs. control group | Gene expression features |
| Visual quality inspection | Product defect types | Image features |
If predictions feed into important decisions in the field, misclassification costs and inspection procedures should be designed together. Rather than letting the model reach conclusions automatically, you should also decide how to choose the cases a person needs to review.
An SVM is a classification method that considers both the boundary between groups and the stability of that boundary.
It’s important to understand the difference between margins and kernels and to check how many errors occur on new data.
When judging whether a semiconductor wafer is normal or defective, a single sensor may not show a clear difference. An SVM considers several sensor values together to find a decision boundary between the two groups, and it adjusts the classification rule based on the observations closest to the boundary. A linear SVM produces a relatively simple boundary, and a kernel SVM can handle complex relationships, but more complex is not always better. Results vary greatly with the amount of data, the patterns in it and the hyperparameter settings.
What matters is not how perfectly the training data were classified, but how well defects in new wafers are actually found. Especially when the defect rate is low, important defects can be missed even with high accuracy, so recall, precision and the confusion matrix should be interpreted together. Only by keeping training and final evaluation separate and following procedures that prevent data leakage can you evaluate an SVM’s performance in a trustworthy way.
An SVM classifies data by considering the decision boundary and the margin. If a linear boundary is not enough you can use a kernel, but C and gamma should be tuned by cross-validation. When classifying defects, don’t look only at accuracy; always check recall, precision and the number of missed defects.