shogun-toolbox/shogun — pull request #401 by iglesias (2012-03-29 09:39:47+00:00)
Title: Generic Multiclass 1vs1

The main new thing is train_one_vs_one, classify_one_vs_one is adapted from shogun/classifier/svm/MulticlassSVM.cpp.

There are also a couple of examples, one for python_modular and another for libshogun. libshogun's example makes use of Streaming classes to read the training data from .mat files without format. The examples use LinearMulticlassMachine with LibLinear classifiers.

A couple of issues:

- I don't know if this one is really important, the training gets normally this warning from LibLinear:

classifier_multiclasslinearmachine_modular.py:24: RuntimeWarning: [WARN] reaching max number of iterations
Using -s 2 may be faster(also see liblinear FAQ)

- I am more worried about this one, libshogun's example under valgrind complains about a couple of memory leaks:

==6590== 24 bytes in 1 blocks are definitely lost in loss record 1 of 2
==6590== at 0x4028876: malloc (vg_replace_malloc.c:236)
==6590== by 0x4028900: realloc (vg_replace_malloc.c:525)
==6590== by 0x44E3679: sg_realloc(void*, unsigned int) (memory.cpp:210)
==6590== by 0x4281003: shogun::v_array::push(shogun::substring const&) (v_array.h:164)
==6590== by 0x432CB30: shogun::CAsciiFile::tokenize(char, shogun::substring, shogun::v_array&) (AsciiFile.cpp:1108)
==6590== by 0x43334D0: shogun::CStreamingAsciiFile::get_vector_and_label(double*&, int&, double&) (StreamingAsciiFile.cpp:268)
==6590== by 0x43F4F7B: shogun::CInputParser::get_vector_and_label(double*&, int&, double&) (InputParser.h:469)
==6590== by 0x43F2938: shogun::CInputParser::main_parse_loop(void*) (InputParser.h:527)
==6590== by 0x43F00B3: shogun::CInputParser::parse_loop_entry_point(void*) (InputParser.h:440)
==6590== by 0x582FD30: start_thread (pthread_create.c:304)
==6590== by 0x48D546D: clone (clone.S:130)
==6590==
==6590== 24 bytes in 1 blocks are definitely lost in loss record 2 of 2
==6590== at 0x4028876: malloc (vg_replace_malloc.c:236)
==6590== by 0x4028900: realloc (vg_replace_malloc.c:525)
==6590== by 0x44E3679: sg_realloc(void*, unsigned int) (memory.cpp:210)
==6590== by 0x4281003: shogun::v_array::push(shogun::substring const&) (v_array.h:164)
==6590== by 0x432CAE9: shogun::CAsciiFile::tokenize(char, shogun::substring, shogun::v_array&) (AsciiFile.cpp:1100)
==6590== by 0x43314B2: shogun::CStreamingAsciiFile::get_vector(double*&, int (StreamingAsciiFile.cpp:147)
==6590== by 0x43F4FEC: shogun::CInputParser::get_vector_only(double*&, int&) (InputParser.h:484)
==6590== by 0x43F2959: shogun::CInputParser::main_parse_loop(void*) (InputParser.h:529)
==6590== by 0x43F00B3: shogun::CInputParser::parse_loop_entry_point(void*) (InputParser.h:440)
==6590== by 0x582FD30: start_thread (pthread_create.c:304)
==6590== by 0x48D546D: clone (clone.S:130)

I don't really know if this is caused for a bad use of streaming classes in my example or because they actually leak. Please let me know something about this.

Still pending to implement set_machine_subset and remove_machine_subset for MulticlassKernel.

Looking forward for your feedback :)