Skip to content

Instantly share code, notes, and snippets.

View sonney2k's full-sized avatar

Soeren Sonnenburg sonney2k

View GitHub Profile
@sonney2k
sonney2k / gist:997253
Created May 28, 2011 21:35
ruby lowercase modules
diff --git a/src/modular/Classifier.i b/src/modular/Classifier.i
index 803f28f..b40478a 100644
--- a/src/modular/Classifier.i
+++ b/src/modular/Classifier.i
@@ -12,7 +12,11 @@
"The `Classifier` module gathers all classifiers available in the SHOGUN toolkit."
%enddef
+#ifndef SWIGRUBY
%module(docstring=DOCSTR) Classifier
@sonney2k
sonney2k / gist:1035341
Created June 20, 2011 09:05
datatype free
template<class T> class SGVector
{
public:
/** default constructor */
SGVector() : vector(NULL), vlen(0), do_free(false) { }
/** constructor for setting params */
SGVector(T* v, index_t len, bool free_vec=false)
: vector(v), vlen(len), do_free(free_vec) { }
@sonney2k
sonney2k / gist:1092373
Created July 19, 2011 13:42
lua shogun distance
require("Distance")
require("Features");
require 'load'
traindat = load_numbers('../data/fm_train_real.dat')
testdat = load_numbers('../data/fm_test_real.dat')
parameter_list = {{traindat,testdat},{traindat,testdat}}
function distance_braycurtis_modular (fm_train_real,fm_test_real)
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7dcfa38 in sigemptyset () from /home/sonne/v/octave/src/.libs/liboctinterp.so.0
(gdb) bt
#0 0x00007ffff7dcfa38 in sigemptyset () from /home/sonne/v/octave/src/.libs/liboctinterp.so.0
#1 0x00007ffff6fabfd1 in octave_set_signal_handler (sig=2, handler=0x7ffff6fac080 <sigint_handler(int)>, restart_syscalls=true) at sighandlers.cc:225
#2 0x00007ffff6fac066 in octave_catch_interrupts () at sighandlers.cc:460
#3 0x00007ffff6fac203 in install_signal_handlers () at sighandlers.cc:529
#4 0x00007ffff6f75ce6 in octave_main (argc=6, argv=0x7fffffffd6a8, embedded=0) at octave.cc:668
#5 0x00000000004006f7 in main (argc=6, argv=0x7fffffffd6a8) at main.c:35
(gdb) up
@sonney2k
sonney2k / gist:1352965
Created November 9, 2011 20:47
octave clang fixes
diff -r 10a5c8155756 liboctave/DiagArray2.h
--- a/liboctave/DiagArray2.h Tue Nov 08 14:50:15 2011 -0500
+++ b/liboctave/DiagArray2.h Wed Nov 09 22:19:22 2011 +0100
@@ -43,7 +43,7 @@
public:
- using Array<T>::element_type;
+ using typename Array<T>::element_type;
@sonney2k
sonney2k / gist:1383965
Created November 21, 2011 21:15
mkl test
#include <shogun/base/init.h>
#include <shogun/classifier/mkl/MKLClassification.h>
#include <shogun/regression/svr/MKLRegression.h>
#include <shogun/regression/svr/LibSVR.h>
#include <shogun/regression/svr/SVRLight.h>
#include <shogun/features/Labels.h>
#include <shogun/lib/DataType.h>
#include <shogun/kernel/CustomKernel.h>
#include <shogun/kernel/CombinedKernel.h>
#include <shogun/features/SimpleFeatures.h>
@sonney2k
sonney2k / gist:1828051
Created February 14, 2012 16:48
test running time of 2 diff JS kernel counting
#include <iostream>
#include <vector>
#include <cmath>
#include <time.h>
using namespace std;
static double
JS1 (const vector<double>& a, const vector<double>& b) {
double result = 0;
@sonney2k
sonney2k / nodifference.cpp
Created February 14, 2012 16:51
no difference
/*g++ -O9 -mfpmath=sse -march=native -mtune=native nodifference.cpp */
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <sys/time.h>
@sonney2k
sonney2k / First Sketch.cpp
Created May 4, 2012 15:48 — forked from nicococo/Sketch.cpp
Shogun Structured Output Toolbox Interface
class CVanillaStructuredOutputMachine : public CMachine {
// Constructor, Destructor
CStructuredOutputMachine(
CStructuredData* trainset,CLoss* loss,CModel* model)
virtual ~CStructuredOutputMachine
// heritable data
CStructuredData* trainset
CLoss* loss
CModel* model
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2013 Soumyajit De
*/
#include <shogun/lib/common.h>