Problem 3: Scale Features Before Training SVM
Easypython
Problem Description
Write a Python program that scales two features of very different ranges using StandardScaler, then trains an SVM classifier on the scaled data.
Input
A dataset with two features of very different scales, and labels.
Output
The prediction for a new, appropriately scaled data point.
Constraints
- None specific.
Example Input
textX=[[1,50000],[2,55000],[9,150000],[10,160000]], y=[0,0,1,1], new=[[5,100000]]
Example Output
textPrediction: [1] (or [0] — the key requirement is consistent scaling of training and new data)
Concepts Covered
StandardScaler, SVC, consistent scaling.