SK-Learn Support Vector Machine

Support vector machines are robust with little to no parameters to tune. They can handle inbalanced data well without resampling. However, they give either a 1 or a 0. Not a range of numbers between 1 and 0 reducing the overall control the end user has as they cannot look at the outcome and decide on cut off parameters to suit their needs. Support vector machines are useful for filters, chopping out loan defaults or ruling someone in for a medical test. However, be careful, only employ this if the recall (percentage of category actually caught and recalled) is high enough for your satifaction.

Parameters

The support vector machine has no parameters as of yet.

Attributes

  • model_title: Set to "Support Vector Machine" for deployment package
  • support_vector: set to True. This has implications in the predicting probability function as the model can only give 0 or 1 and nothing inbetween

Methods

The support vector machine has no unique methods yet, but does have all the standard training and deployment methods.

Practical Example

Below is a practical example of training a support vector machine:

from deployml.sklearn.models.support_vector import SVMBase

# We define the model
svm = SVMBase()

# We define the data (pandas data frame)
svm.data = input_data

# We define the key of the column we are trying to predict
svm.outcome_pointer = 'attended'

# We now train the support vector machine. These things can take a lot
# of time to train so it's advise to use the quick_train method with 
# scaled data 
svm.quick_train(scale=True)

# We then print out the precision, recall and F-1 score 
svm.evaluate_outcome()

# And show the ROC curve 
svm.show_roc_curve()

Not enough?

It's understandable that you might want a more custom model. Whilst we are always working on making Deploy-ML more versatile, you can define your own SK-Learn model and import it into the Deploy-ML learning and packaging framework!