Navigation Menu

Skip to content

Commit

Permalink
Added brief intro to NewtonSVM and added octave_modular example
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshit Syal committed Apr 5, 2012
1 parent 874ebc5 commit 9241292
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
@@ -0,0 +1,34 @@
init_shogun

addpath('tools');
label=load_matrix('../data/label_train_dna.dat');
data=load_matrix('../data/fm_train_dna.dat');
fm_test_real=load_matrix('../data/fm_test_dna.dat');

% Newton SVM

disp('NewtonSVM')
data=double(data);
%fm_test_real=double(fm_test_real);
realfeat=RealFeatures(data);
feats_train=SparseRealFeatures();
feats_train.obtain_from_simple(realfeat);
%realfeat=RealFeatures(fm_test_real);
%feats_test=SparseRealFeatures();
%feats_test.obtain_from_simple(realfeat);

C=1.0;
epsilon=1e-5;
num_threads=1;
label=double(label);
labels=Labels(label);

svm=NewtonSVM(C, feats_train, labels);
svm.set_epsilon(epsilon);
svm.parallel.set_num_threads(num_threads);
svm.set_bias_enabled(true);
svm.train();
%svm.set_features(feats_test);
svm.get_bias();
svm.get_w();
%svm.apply().get_labels();
8 changes: 6 additions & 2 deletions src/shogun/classifier/svm/NewtonSVM.h
Expand Up @@ -19,7 +19,11 @@
namespace shogun
{
#ifdef HAVE_LAPACK
/** @brief class NewtonSVM */
/** @brief NewtonSVM,
* In this Implementation linear SVM is trained in its primal form using Newton-like iterations.
* This Implementation is ported from the Olivier Chapelles fast newton based SVM solver, Which could be found here :http://mloss.org/software/view/30/
* For further information on this implementation of SVM refer to this paper: http://www.kyb.mpg.de/publications/attachments/neco_%5B0%5D.pdf
*/
class CNewtonSVM : public CLinearMachine
{
public:
Expand All @@ -38,7 +42,7 @@ class CNewtonSVM : public CLinearMachine

/** get classifier type
*
* @return classifier type NewtonSVM
il * @return classifier type NewtonSVM
*/
virtual inline EClassifierType get_classifier_type() { return CT_NEWTONSVM; }

Expand Down

0 comments on commit 9241292

Please sign in to comment.