What is a good range of values for the svm.SVC hyperparameters to be explored via GridSearchCV?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
There is no single best SVC grid that works for every dataset. The right search range depends heavily on feature scaling, kernel choice, dataset size, and whether the classes overlap cleanly.
That said, there is a practical starting point: search C and gamma on a logarithmic scale, keep separate grids for different kernels, and always put scaling inside the cross-validation pipeline. Blindly trying a huge dense grid is usually slower and less informative than a small well-structured search.
Start with Scaled Features
SVMs are sensitive to feature magnitudes. If one feature ranges from 0 to 1 and another from 0 to 10000, the kernel distance calculations become distorted.
That means the hyperparameter search should almost always be wrapped in a pipeline:
Without scaling, the best C and gamma values from cross-validation often reflect bad preprocessing rather than real model quality.
Good Starting Ranges
For rbf SVC, a practical coarse grid is:
- '
C:1e-3,1e-2,1e-1,1,10,100,1000' - '
gamma:1e-4,1e-3,1e-2,1e-1,1,'scale''
For linear kernel:
- '
C:1e-3,1e-2,1e-1,1,10,100,1000'
For poly kernel, keep the grid small because it gets expensive:
- '
C:1e-2,1e-1,1,10' - '
degree:2,3,4' - '
gamma:'scale',1e-3,1e-2'
These are starting ranges, not final answers. Once the coarse search identifies a promising zone, do a narrower second pass nearby.
Use Separate Grids per Kernel
Do not put every kernel and every parameter into one giant Cartesian product. Some parameters are irrelevant for some kernels, and a combined grid becomes noisy and expensive.
A cleaner approach:
This keeps the search interpretable and avoids wasting time on meaningless combinations.
How To Interpret C and gamma
C controls regularization:
- small
Cmeans a smoother, more tolerant boundary - large
Cmeans the model tries harder to classify training points correctly
gamma controls how localized the RBF or polynomial decision surface becomes:
- small
gammameans smoother influence over a wider area - large
gammameans each point influences only a tiny neighborhood
Very large C and very large gamma together are a classic overfitting combination.
When the Range Should Change
Adjust the search if:
- the dataset is huge and exact SVC is becoming too slow
- features are sparse and high-dimensional, where linear models may dominate
- classes are imbalanced, requiring class weights or a different scoring metric
For large sparse text data, LinearSVC is often a better tool than kernelized SVC. A wide kernel search in that setting is usually wasted effort.
Common Pitfalls
- Searching SVC hyperparameters without scaling the features.
- Using one giant grid that mixes irrelevant parameters across kernels.
- Exploring only tiny linear ranges such as
C = [1, 2, 3]instead of log-scale ranges. - Judging performance by accuracy alone on imbalanced data.
- Running an expensive exhaustive grid before doing a small coarse search.
Summary
- Start with a
Pipelinethat includes feature scaling. - Search
Candgammaon logarithmic ranges, not narrow linear ones. - Use separate parameter grids for separate kernels.
- Begin with a coarse search and refine around the best region.
- If the dataset is large or sparse, consider whether
LinearSVCis the better model.

