Implementing a weighted support vector machine in python

I have the following problem.

The minimization problem of the SVM that I want to solve is:

$$ \min_{w, b} \frac{1}{2}w^{T}w + \sum^{m}_{i=1}C_{i}xi_{i} $$ Subject to: $$ y_{i}(w^{T}x_{i} - b) \geq 1 - \xi_{i} $$ $$ \xi_{i} \geq 0 $$ $$ C_{i} = \nu_{i}C $$ where $\nu_{i}$ is some function.

Now the minimization problem that the base SVM solves is: $$ \min_{w, b} \frac{1}{2}w^{T}w + C\sum^{m}_{i=1}xi_{i} $$ Subject to: $$ y_{i}(w^{T}x_{i} - b) \geq 1 - \xi_{i} $$ $$ \xi_{i} \geq 0 $$

reference: https://www.sciencedirect.com/science/article/abs/pii/S0957417414006228?via%3Dihub

or: https://www.researchgate.net/publication/268753346_Using_Volume_Weighted_Support_Vector_Machines_with_walk_forward_testing_and_feature_selection_for_the_purpose_of_creating_stock_trading_strategy

I was wondering is there a way I can change implement this in sklearn, its for a paper that im working.

Kind regards.

Topic svm python libsvm

Category Data Science


This is already implemented, with the sample_weights parameter of the fit method. They play the role of your $\nu_i$.

About

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