Converting LinearSVC's Decision Function To Probabilities (Scikit Learn Python )
Answer : scikit-learn provides CalibratedClassifierCV which can be used to solve this problem: it allows to add probability output to LinearSVC or any other classifier which implements decision_function method: svm = LinearSVC() clf = CalibratedClassifierCV(svm) clf.fit(X_train, y_train) y_proba = clf.predict_proba(X_test) User guide has a nice section on that. By default CalibratedClassifierCV+LinearSVC will get you Platt scaling, but it also provides other options (isotonic regression method), and it is not limited to SVM classifiers. I took a look at the apis in sklearn.svm.* family. All below models, e.g., sklearn.svm.SVC sklearn.svm.NuSVC sklearn.svm.SVR sklearn.svm.NuSVR have a common interface that supplies a probability: boolean, optional (default=False) parameter to the model. If this parameter is set to True, libsvm will train a probability transformation model on top of the SVM's outputs based on idea of Platt Scaling. The form of transformation is similar to a lo...