Problem 2: Compare Linear and RBF Kernels
Easypython
Problem Description
Write a Python program that trains two SVM models — one with a linear kernel, one with an RBF kernel — on the same dataset, and compares their predictions on the same new data point.
Input
A labeled dataset and one new data point.
Output
Predictions from both kernel types.
Constraints
- At least 8 labeled training examples.
Example Input
textX=[[1,60],[2,65],[8,95],[9,98],[4,72],[6,88]], y=[0,0,1,1,0,1], new=[[5,80]]
Example Output
textLinear kernel prediction: [1] RBF kernel prediction: [1]
Concepts Covered
kernel parameter comparison.