For example, when I have a problem that false negative should be penalised more, how can I incorporate that requirement in the algorithm such as SVM?


1 Answer 1


There are several ways in which you can achieve your desired result:

  • Implement the make_scorer function from Scikit learn
  • Make modification to the class_weight argument

In regards to your SVM question take a look at the below code:

 class sklearn.svm.SVC(C=1.0, kernel='rbf', degree=4, gamma=0.0,
 coef0=0.0, shrinking=True, probability=False, tol=0.003,
 cache_size=300, class_weight=None, verbose=False, max_iter=-1,

In the above example, the class_weight function can be changed to 'auto' or you can pass dictionary values which have the user-defined class weights.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.