class SVM(StatModel):
    """wrapper for OpenCV SimpleVectorMachine algorithm"""

def __init__(self):
    self.model = cv2.SVM()

def train(self, samples, responses):
    params = dict(kernel_type=cv2.SVM_LINEAR, svm_type=cv2.SVM_C_SVC, C=1)
self.model.train(samples, responses, params=params)

def predict(self, samples):
    return np.float32([self.model.predict(s) for s in samples])
Python OpenCV SVM implementation