← 9. Prediction & machine learning

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.

Decision boundaryMaximum marginSupport vectorsKernels

Linear SVMRBF kernel SVMNormalDefectiveSupport vectors

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.

SECTION 1

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.

SECTION 2

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.

SECTION 3

How does an SVM work?

The decision boundary, the margin and the support vectors are the key ideas.

Can sensor readings identify defective wafers?Concept mock-up of the boundary and margin separating normal and defective samplesLinear SVMRBF kernel SVMNormalDefectiveSupport vectors (example)
Comparison of a straight and a curved boundary. The points and support vector positions are a concept mock-up for explaining the idea.

① 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.

SECTION 4

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.

VariableExample dataRole
Final inspection resultNormal / defectiveTarget to classify
Process temperature°CPredictor
Chamber pressurekPaPredictor
Vibration magnitudemm/sPredictor
CurrentAPredictor
Number of records500 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.

SECTION 5

What do you check before applying an SVM?

Check the scale of the variables, the defect rate and the possibility of data leakage.

Check itemWhat to checkWhy it matters
Sensor value rangesUnits and scales of temperature, pressure and currentAffects distance and kernel calculations
Class proportions90% normal, 10% defectiveEvaluating on accuracy alone is risky
Missing values and outliersSensor errors, missing readingsAffects the boundary and scaling
Data leakageWhether values only known after quality inspection are includedPrevents overestimating real predictive performance
Same production lotWhether lots overlap between training and test dataImportant for independent evaluation
Future operating conditionsSensor distributions after process changes or with new equipmentPossible drop in on-site performance
Most important point in preprocessing: The mean and standard deviation needed for standardization must be computed from the training data only and then applied unchanged to the test data. If many wafers come from the same production lot, splitting by lot may be more appropriate.
SECTION 6

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.

SECTION 7

What do C and gamma control?

They control how much margin violation is allowed and how complex the decision boundary is.

SettingSmaller valueLarger value
CSmaller penalty for margin violations, so stronger regularizationMargin violations are penalized more heavily, so a more complex boundary can be chosen
gamma (RBF)Each data point’s range of influence becomes widerRange 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.

SECTION 8

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 \ PredictedNormalDefectiveTotal
Normal82890
Defective2810
Total8416100

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.

Classification results for the 100 final test wafersPredicted normalPredicted defectiveActually normalActually defective82882Defect recall80.0%
Confusion matrix mock-up. Rows are the actual result and columns are the SVM’s prediction; all figures are hypothetical, for learning.
SECTION 9

How do you compare SVM performance?

Look at linear and nonlinear boundaries using the same evaluation criteria.

Hypothetical metricLinear SVMRBF SVM
Cross-validated defect F155.0%62.0%
Final test accuracy88.0%90.0%
Final test defect recall70.0%80.0%
Final test defect precision43.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.

SECTION 10

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.

SECTION 11

How does it differ from other analyses?

The goal of classifying groups may be the same, but the way the boundary is learned differs.

MethodHow it classifiesWhat sets it apart
SVMOptimizes the decision boundary with the margin in mindCan handle nonlinear relationships with kernels
Logistic regressionModels the log-odds of group membershipCoefficients and odds ratios are relatively easy to interpret
Discriminant analysis (LDA/QDA)Uses assumptions about each group’s distribution and covarianceComputes probabilities and boundaries under distributional assumptions
KNNClassifies by the majority label of nearby dataSensitive to distance, K and scale
Decision treeBuilds splitting rules based on variable valuesRules 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.

SECTION 12

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.

Example report sentences

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.

SECTION 13

Where can SVMs be used?

In situations where groups are distinguished by many features, such as sensors, images or text.

FieldWhat is classifiedVariables that can be used
Semiconductor manufacturingNormal vs. defective wafersTemperature, pressure, vibration, current
Equipment maintenanceNormal vs. abnormal statesSensor signals, vibration frequencies
Text analysisSpam vs. legitimate emailWord frequencies, sentence features
BioinformaticsPatient group vs. control groupGene expression features
Visual quality inspectionProduct defect typesImage 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.

✓ Wrap-up

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.

KEY TAKEAWAY

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.