Get the prediction probability using prediction function

I'm new to SVM models. I took custom SVM classifier from the github. In there standard predict function was overwritten by custom predict function.

def predict(self, instances):
   predictions = []
   for instance in instances:
       predictions.append((int)(np.sign(self.weight_vector.dot(instance.T)[0] + self.bias)))#class is determined based on the sign -1,1

I want to get prediction probability of each class. [-1 probability, 1 probability] I know from standard SVM predict_proba function I can get the probability. Since this is a customized SVM how do I get that? Can somebody help me.

Thank you

Topic predict svm

Category Data Science


I have followed scikit-learn https://github.com/scikit-learn/scikit-learn/blob/fd237278e/sklearn/linear_model/_base.py#L293 link and was able to get predicted probabilities.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.