ShareBoost

The shareBoost algorithm learns a multiclass predictor from a subset of shared features of the samples with forward greedy selection approach.

See [SSWS11] for a detailed introduction.

Example

Imagine we have files with training and test data. We create CDenseFeatures (here 64 bit floats aka RealFeatures) and CMulticlassLabels as

features_train = RealFeatures(f_feats_train)
features_test = RealFeatures(f_feats_test)
labels_train = MulticlassLabels(f_labels_train)
labels_test = MulticlassLabels(f_labels_test)
features_train = RealFeatures(f_feats_train);
features_test = RealFeatures(f_feats_test);
labels_train = MulticlassLabels(f_labels_train);
labels_test = MulticlassLabels(f_labels_test);
RealFeatures features_train = new RealFeatures(f_feats_train);
RealFeatures features_test = new RealFeatures(f_feats_test);
MulticlassLabels labels_train = new MulticlassLabels(f_labels_train);
MulticlassLabels labels_test = new MulticlassLabels(f_labels_test);
features_train = Modshogun::RealFeatures.new f_feats_train
features_test = Modshogun::RealFeatures.new f_feats_test
labels_train = Modshogun::MulticlassLabels.new f_labels_train
labels_test = Modshogun::MulticlassLabels.new f_labels_test
features_train <- RealFeatures(f_feats_train)
features_test <- RealFeatures(f_feats_test)
labels_train <- MulticlassLabels(f_labels_train)
labels_test <- MulticlassLabels(f_labels_test)
features_train = modshogun.RealFeatures(f_feats_train)
features_test = modshogun.RealFeatures(f_feats_test)
labels_train = modshogun.MulticlassLabels(f_labels_train)
labels_test = modshogun.MulticlassLabels(f_labels_test)
RealFeatures features_train = new RealFeatures(f_feats_train);
RealFeatures features_test = new RealFeatures(f_feats_test);
MulticlassLabels labels_train = new MulticlassLabels(f_labels_train);
MulticlassLabels labels_test = new MulticlassLabels(f_labels_test);
auto features_train = some<CDenseFeatures<float64_t>>(f_feats_train);
auto features_test = some<CDenseFeatures<float64_t>>(f_feats_test);
auto labels_train = some<CMulticlassLabels>(f_labels_train);
auto labels_test = some<CMulticlassLabels>(f_labels_test);

We create an instance of the CShareBoost classifier by setting the number of features expected to be used for learning.

shareboost = ShareBoost(features_train, labels_train, 2)
shareboost = ShareBoost(features_train, labels_train, 2);
ShareBoost shareboost = new ShareBoost(features_train, labels_train, 2);
shareboost = Modshogun::ShareBoost.new features_train, labels_train, 2
shareboost <- ShareBoost(features_train, labels_train, 2)
shareboost = modshogun.ShareBoost(features_train, labels_train, 2)
ShareBoost shareboost = new ShareBoost(features_train, labels_train, 2);
auto shareboost = some<CShareBoost>(features_train, labels_train, 2);

Then we train and apply it to test data, which gives CMulticlassLabels.

shareboost.train()
features_test_sub = RealSubsetFeatures(features_test, shareboost.get_activeset())
labels_predict = shareboost.apply_multiclass(features_test_sub)
shareboost.train();
features_test_sub = RealSubsetFeatures(features_test, shareboost.get_activeset());
labels_predict = shareboost.apply_multiclass(features_test_sub);
shareboost.train();
RealSubsetFeatures features_test_sub = new RealSubsetFeatures(features_test, shareboost.get_activeset());
MulticlassLabels labels_predict = shareboost.apply_multiclass(features_test_sub);
shareboost.train 
features_test_sub = Modshogun::RealSubsetFeatures.new features_test, shareboost.get_activeset 
labels_predict = shareboost.apply_multiclass features_test_sub
shareboost$train()
features_test_sub <- RealSubsetFeatures(features_test, shareboost$get_activeset())
labels_predict <- shareboost$apply_multiclass(features_test_sub)
shareboost:train()
features_test_sub = modshogun.RealSubsetFeatures(features_test, shareboost:get_activeset())
labels_predict = shareboost:apply_multiclass(features_test_sub)
shareboost.train();
RealSubsetFeatures features_test_sub = new RealSubsetFeatures(features_test, shareboost.get_activeset());
MulticlassLabels labels_predict = shareboost.apply_multiclass(features_test_sub);
shareboost->train();
auto features_test_sub = some<CDenseSubsetFeatures<float64_t>>(features_test, shareboost->get_activeset());
auto labels_predict = shareboost->apply_multiclass(features_test_sub);

We can evaluate test performance via e.g. CMulticlassAccuracy.

eval = MulticlassAccuracy()
accuracy = eval.evaluate(labels_predict, labels_test)
eval = MulticlassAccuracy();
accuracy = eval.evaluate(labels_predict, labels_test);
MulticlassAccuracy eval = new MulticlassAccuracy();
double accuracy = eval.evaluate(labels_predict, labels_test);
eval = Modshogun::MulticlassAccuracy.new 
accuracy = eval.evaluate labels_predict, labels_test
eval <- MulticlassAccuracy()
accuracy <- eval$evaluate(labels_predict, labels_test)
eval = modshogun.MulticlassAccuracy()
accuracy = eval:evaluate(labels_predict, labels_test)
MulticlassAccuracy eval = new MulticlassAccuracy();
double accuracy = eval.evaluate(labels_predict, labels_test);
auto eval = some<CMulticlassAccuracy>();
auto accuracy = eval->evaluate(labels_predict, labels_test);

References

[SSWS11]S. Shalev-Shwartz, Y. Wexler, and A. Shashua. Shareboost: efficient multiclass learning with feature sharing. In Advances in Neural Information Processing Systems, 1179–1187. 2011.