TransWikia.com

Get the prediction probability using prediction function

Data Science Asked by AbRe on July 26, 2021

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

One Answer

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.

Answered by AbRe on July 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP