Problem 1: Train a Linear SVM Classifier
Easypython
Learn the Concept: Support Vector MachinesProblem Description
Write a Python program that trains an SVM with a linear kernel on a labeled dataset, and predicts the class for a new data point.
Input
A labeled dataset and one new data point.
Output
The predicted class.
Constraints
- At least 6 labeled training examples.
Example Input
textX=[[1,60],[2,65],[8,95],[9,98]], y=[0,0,1,1], new=[[7,90]]
Example Output
textPrediction: [1]
Concepts Covered
SVC(kernel="linear"), .fit(), .predict().
Related Problems
- Problem 2: Compare Linear and RBF KernelsEasy · pythonSolve Problem
- Problem 3: Scale Features Before Training SVMEasy · pythonSolve Problem
- Problem 4: Identify Support VectorsEasy · pythonSolve Problem