SVM Multi-class Classification
Multiclass SVM aims to assign labels to instances by using support vector machines, where the labels are drawn from a finite set of several elements.
The implemented approach for doing so is to reduce the single multiclass problem into multiple binary classification problems via one-versus-all.
The one-versus-all approach is the process of building binary classifiers which distinguish between one of the labels and the rest.
The model keeps the pairs
<ClassLabel, SVMLinearBinaryClassificationModel> and it enables a prediction to be made for a given vector of features, in the following way:
SVMLinearMultiClassClassificationModel model = ...; double prediction = model.predict(observation);
Presently, Ignite supports the following parameters for
amountOfIterations- amount of outer SDCA algorithm iterations. (default value:
amountOfLocIterations- amount of local SDCA algorithm iterations. (default value:
lambda- regularization parameter (default value:
All properties will be propagated for each pair one-versus-all
// Set up the trainer SVMLinearMultiClassClassificationTrainer trainer = new SVMLinearMultiClassClassificationTrainer() .withAmountOfIterations(AMOUNT_OF_ITERATIONS) .withAmountOfLocIterations(AMOUNT_OF_LOC_ITERATIONS) .withLambda(LAMBDA); // Build the model SVMLinearMultiClassClassificationModel mdl = trainer.fit( datasetBuilder, featureExtractor, labelExtractor );
To see how SVM Linear Multi-Class Classifier can be used in practice, try this example, available on GitHub and delivered with every Apache Ignite distribution.
The preprocessed Glass dataset is from the UCI Machine Learning Repository.
There are 3 classes with labels: 1 (building_windows_float_processed), 3 (vehicle_windows_float_processed), 7 (headlamps) and feature names: 'Na-Sodium', 'Mg-Magnesium', 'Al-Aluminum', 'Ba-Barium', 'Fe-Iron'.