Ask Your Question

Revision history [back]

SVM: How to ignore a feature when using a non-linear kernel

using OpenCV 3.1, I'm using the SVM learning algorithm with a non-linear kernel.

I implemented a function:

void extractFeatures(cv::Mat& img, std::vector<double>& meta, std::vector<double>& features)

which takes certain information from img and meta, manipulates it and stores it in features which I then give to SVM's train(...) or predict(...).

My training data has all the meta information, but in my use case the images I want to predict on might not have.

I thought of two solutions:

  1. draw values uniformly at random for the missing features (obviously bad for predicting but at least no bias).
  2. zero out these features so they don't contribute to the prediction at all.

I would prefer solution 2, but I've run into a problem zeroing out features in the kerneled space (when using a non-linear kernel).


I woud appreciate a way to implement solution 2 or something close. Also, if someone has other recomendations for dealing with missing data I'm open to suggestions.