Skip to content

Instantly share code, notes, and snippets.

View van51's full-sized avatar

Evangelos Anagnostopoulos van51

View GitHub Profile
@van51
van51 / valgrind.out
Last active December 24, 2015 02:49
user@okeanos:~$ valgrind ./webspam_example
==30295== Memcheck, a memory error detector
==30295== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seauser@okeanos:~$ valgrind ./webspam_example
==10090== Memcheck, a memory error detector
==10090== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==10090== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==10090== Command: ./webspam_example
==10090==
Loading data..
Loading data
#include <shogun/classifier/svm/LibSVM.h>
#include <shogun/classifier/svm/SVMLight.h>
#include <shogun/classifier/svm/SVMOcas.h>
#include <shogun/features/HashedDocDotFeatures.h>
#include <shogun/evaluation/PRCEvaluation.h>
#include <shogun/evaluation/ROCEvaluation.h>
#include <shogun/base/init.h>
#include <shogun/io/LineReader.h>
#include <shogun/io/SerializableAsciiFile.h>
#include <shogun/labels/BinaryLabels.h>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
user@okeanos:~/shogun/benchmarks$ g++ rf_feats_benchmark.cpp -o rf_feats_benchmark -lshogun -std=c++11
user@okeanos:~/shogun/benchmarks$ ./rf_feats_benchmark
-------------------------------------------------------------------------
Starting experiment for number of dimensions = 100, number of vectors = 100000, using kernel_width = 80.000000
Results for D = 50
Time to process 5 x num=100000 dense_dot_range ops: cputime 2.150000s walltime 0.376694s
Time to process 5 x num=100000 add_to_dense_vector ops: cputime 1.242000s walltime 1.241402s
Results for D = 100
Time to process 5 x num=100000 dense_dot_range ops: cputime 3.640000s walltime 0.603914s
Time to process 5 x num=100000 add_to_dense_vector ops: cputime 2.498000s walltime 2.498035s
user@okeanos-vasilis:~/shogun/benchmarks$ g++ rf_feats_benchmark.cpp -o rf_feats_benchmark -lshogun -std=c++11
user@okeanos-vasilis:~/shogun/benchmarks$ ./rf_feats_benchmark
-------------------------------------------------------------------------
Starting experiment for number of dimensions = 100, number of vectors = 100000, using kernel_width = 80.000000
Results for D = 50
Time to process 5 x num=100000 dense_dot_range ops: cputime 2.122000s walltime 0.387416s
Time to process 5 x num=100000 add_to_dense_vector ops: cputime 1.236000s walltime 1.235772s
Results for D = 100
Time to process 5 x num=100000 dense_dot_range ops: cputime 3.374000s walltime 0.508607s
Time to process 5 x num=100000 add_to_dense_vector ops: cputime 2.554000s walltime 2.553651s
user@okeanos:~$ wc -l data/adult/a9a.t*
16281 data/adult/a9a.t
32561 data/adult/a9a.tr
48842 total
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
user@okeanos:~$ ./random_fourier_classification --dataset data/adult/a9a.tr --testset data/adult/a9a.t --dimension 123 -D 500
Starting training
Training completed, took 67,400000s
Training auPRC=0,730294, auROC=0,891133, accuracy=0,841897 ( Incorrectly predicted=15,810323% )
@van51
van51 / output.sh
Last active December 22, 2015 19:49
With my changes :
user@okeanos:~$ du -h ld_new_40_3x2.svm
116K ld_new_40_3x2.svm
user@okeanos:~$ wc -l ld_new_40_3x2.svm
72 ld_new_40_3x2.svm
user@okeanos:~$ grep features ld_new_40_3x2.svm
store_model_features bool f
store_model_features bool f
features SGSerializable* null []
@van51
van51 / rf_feat_kernel_comp.txt
Created September 5, 2013 18:17
Comparisons between SVMOcas+RFDotFeatures vs LibSVM+GaussianKernel.
Starting experiment for number of dimensions = 10
Using 10000 examples
Using kernel_width = 8.000000
SVMOcas using RFDotFeatures(D=50) finished training. Took 0.942949s (or 4.200000s), SVMOcas auPRC=0.999800 (Applying took 0.028884s (0.220000s)
SVMOcas using RFDotFeatures(D=100) finished training. Took 1.483577s (or 7.250000s), SVMOcas auPRC=0.999800 (Applying took 0.054845s (0.430000s)
SVMOcas using RFDotFeatures(D=300) finished training. Took 3.962014s (or 20.490000s), SVMOcas auPRC=0.999800 (Applying took 0.161798s (1.040000s)
SVMOcas using RFDotFeatures(D=1000) finished training. Took 13.028605s (or 62.740000s), SVMOcas auPRC=0.999800 (Applying took 0.477909s (2.540000s)
LibSVM using GaussianKernel finished training. Took 0.791424s (or 2.200000s), LibSVM auPRC=0.999800 (Applying took 0.164478s (1.280000s)
Using 100000 examples
Using kernel_width = 8.000000
@van51
van51 / random_fourier_kernel_comparison.cpp
Created August 28, 2013 15:57
Comparison between the Gaussian kernel matrix and the matrix computed from the dot products of the vectors of CRandomFourierDotFeatures.
#include <shogun/base/init.h>
#include <shogun/features/RandomFourierDotFeatures.h>
#include <shogun/kernel/GaussianKernel.h>
#include <shogun/kernel/normalizer/IdentityKernelNormalizer.h>
#include <stdio.h>
using namespace shogun;
int main(int argv, char** argc)
@van51
van51 / random_fourier_results.txt
Last active December 21, 2015 21:19
Comparison between the Gaussian kernel matrix and the matrix computed from the dot products of the vectors of CRandomFourierDotFeatures.
Results below are computed as :
kernel_matrix = gaussian_kernel.get_kernel_matrix();
rand_four_matrix = {Dot product of every vector with each other, in the CRandomFourierDotFeatures object }
max_diff = max(abs(kernel_matrix-rand_four_matrix));
Link to the code used : https://gist.github.com/van51/6367688
Results:
Starting experiment for number of dimensions = 100
Using kernel_width = 80.000000