Skip to content

Transductive Classifiers

davidpicard edited this page Apr 12, 2013 · 1 revision

Training a transductive classifier is about the same as with regular classifiers, with the addition that you must call the method train with two lists of TrainingSample as parameters. The first one should contain the labeled training samples, whereas the second contains the unlabeled test data.

For example, A S3VMLight classifier with GaussianKernel on vectors of double would be done as follows:

List<TrainingSample<double[]>> train = new ArrayList<TrainingSample<double[]>>();
List<TrainingSample<double[]>> test = new ArrayList<TrainingSample<double[]>>();

/* here goes the code where you feed the train list with labeled samples */
/* here goes the code where you feed the test list with unlabeled samples */

DoubleGaussL2 k = new DoubleGaussL2();
S3VMLight<double[]> svm = new S3VMLight<double[]>(k);
svm.train(train, test);

In this example, the evaluation of a new sample is the same as with regular classifiers:

double[] sample;
// filling sample

double value = svm.valueOf(sample);