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.


1 Answer 1


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

  • $\begingroup$ Yes, it worked. Excellent! $\endgroup$
    – cem
    Commented Jun 28, 2021 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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