title: Labeling one class for cross validation in libsvm matlab
body: <p>I want to use one-class classification using LibSVM in MATLAB.</p>
  
  <p>I want to train data and use cross validation, but I don't know what I have to do to label the outliers.</p>
  
  <p>If for example I have this data:</p>
  
  <pre><code>trainData =  [1,1,1; 1,1,2; 1,1,1.5; 1,1.5,1; 20,2,3; 2,20,2; 2,20,5; 20,2,2];
  labelTrainData = [-1 -1 -1 -1 0 0 0 0];  
  </code></pre>
  
  <p>(The first four are examples of the 1 class, the other four are examples of outliers, just for the cross validation)</p>
  
  <p>And I train the model using this:</p>
  
  <pre><code>model = svmtrain(labelTrainData, trainData , '-s 2 -t 0 -d 3 -g 2.0 -r 2.0 -n 0.5 -m 40.0 -c 0.0 -e 0.0010 -p 0.1 -v 2' );
  </code></pre>
  
  <p>I'm not sure which value use to label the 1-class data and what to use to the outliers. Does someone knows how to do this?.</p>
  
  <p>Thanks in advance.
  -Jessica</p>