Lessons / Part 8. Machine learning on small data in plain terms
48 Kernel models in plain terms
A scaled support vector regressor and a Gaussian process with a band that is read as the kernel's opinion, not as measured error.
What people usually ask
Try an SVM on my data.
What comes back
A classifier fitted to a continuous viscosity column with no scaling, and either an error or an accuracy that means nothing.
Ask this instead
I have visc.csv: 30 runs, columns conc_wt_pct, temp_C and viscosity_mPas. The target is continuous, so this is regression, not classification.
1. A Pipeline of StandardScaler then SVR. Choose C from [0.1, 1, 10, 100] and epsilon from [0.01, 0.1, 1] with GridSearchCV, 5 folds, scoring neg_root_mean_squared_error. Print the chosen values and the cross validated RMSE.
2. A GaussianProcessRegressor with kernel ConstantKernel() * RBF() + WhiteKernel(), inputs scaled the same way, normalize_y=True. Print the fitted kernel with its length scale and noise level.
3. For the Gaussian process, plot the mean prediction against conc_wt_pct at temp_C = 25 with a band of two standard deviations, the measured points on top.
4. Under the plot, state that the band is what the chosen kernel implies, not a measured error: it narrows near points and widens between them.
Report both RMSEs beside a mean predictor under the same folds. Do not drop rows. Do not plot or report any value outside the measured range of either input.
Attach: The run table as CSV.
Why it works: Scaling sits inside the pipeline so the folds stay honest, and the band is named for what it is before anyone reads it as an error bar.
Drafted with Fable 5.1 from my notes; chosen and edited by me.