9

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?

Ghostintheshell
  • 451
  • 1
  • 5
  • 7

1 Answers1

3

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,
 random_state=None)

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.