Skip to content

Instantly share code, notes, and snippets.

View sanuj's full-sized avatar

Sanuj Sharma sanuj

View GitHub Profile
require 'modshogun'
f_feats_train = Modshogun::CSVFile.new "../../data/classifier_binary_2d_nonlinear_features_train.dat"
f_feats_test = Modshogun::CSVFile.new "../../data/classifier_binary_2d_nonlinear_features_test.dat"
f_labels_train = Modshogun::CSVFile.new "../../data/classifier_binary_2d_nonlinear_labels_train.dat"
f_labels_test = Modshogun::CSVFile.new "../../data/classifier_binary_2d_nonlinear_labels_test.dat"
#![create_features]
features_train = Modshogun::RealFeatures.new f_feats_train
features_test = Modshogun::RealFeatures.new f_feats_test
// loadLibrary has SG_INFO("Loaded.\n");
int main()
{
init_shogun_with_defaults();
SGIO *io = get_global_io();
io->set_target_to_stdout();
auto library = shogun::loadLibrary("/home/sanuj/Projects/shogun/buildcpp/tests/unit/libplugin.so");
auto manifest = library.manifest();
auto metaclass = manifest.classByName<MockBaseClass>("m_class");
[ 1%] [ 1%] Built target HeadersProtobuf
Generating version header
[ 1%] Built target ShogunVersionProtobuf
[ 1%] Built target ChunksProtobuf
[ 1%] Built target class_list
[ 1%] Built target GoogleMock
[ 1%] Built target ctags
[ 1%] Built target discover_gtest_tests
[ 1%] Generating examples from meta-language
[ 1%] Built target version
/*
* THIS IS A GENERATED FILE! DO NOT CHANGE THIS FILE! CHANGE THE
* CORRESPONDING TEMPLATE FILE, PLEASE!
*/
using namespace shogun;
%template(TagString) Tag<std::string>;
@sanuj
sanuj / error.txt
Created July 1, 2016 07:19
Error while building MulticlassSVM cookbook.
[ 0%] Built target class_list
[ 0%] Built target HeadersProtobuf
[ 0%] Built target ChunksProtobuf
[ 1%] Built target ShogunVersionProtobuf
[ 3%] Generating version header
[ 3%] Built target version
[ 96%] Built target libshogun
[ 96%] Built target shogun
[ 96%] Built target ctags
[ 96%] Generating examples from meta-language
@sanuj
sanuj / sg_swig_example.py
Created June 20, 2016 08:45
Demo code for usage of Tags and new parameter framework in Shogun
import modshogun as sg
ck = sg.CombinedKernel()
ck.setInt("num_kernels", 3)
gk = sg.GaussianKernel(10, 5)
gk_tag = sg.TagKernel("gaussian")
print gk == ck.set(gk_tag, gk) # returns gk
if gk == ck.getKernel("gaussian") and gk == ck.get(gk_tag):
print "Fetched gaussian kernel with width = 5"

In SGObject.h:

class CSGObject {
  ...
  private:
    ...
    struct Self;
    DPtr<Self> self;
  ...
}
@sanuj
sanuj / Base_Shogun.md
Last active May 19, 2016 12:44
Details about base shogun framework

machine

  • CMulticlassMachine > CBaseMulticlassMachine > [3]
  • CLinearLatentMachine > CLinearMachine > [3]
  • gp/CDualVariationalGaussianLikelihood > [4]
  • gp/CNumericalVGLikelihood > [4]
  • gp/CSingleFITCInference > CSingleSparseInference > CSparseInference > [2]
  • gp/CKLLowerTriangularInference > CKLInference > [2]
  • gp/CLaplaceInference > [2]
  • gp/CMeanFunction > CSGObject
@sanuj
sanuj / design_draft.md
Last active May 16, 2016 16:16
Design Draft for parameter framework for Shogun

Tags and string parameters

Tags

Template class for Tag will look like:

template <class T>
class Tag
{
 public:
-- Using system's malloc
-- Could NOT find MOSEK (missing:  MOSEK_DIR MOSEK_INCLUDE_DIR MOSEK_LIBRARY) 
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Could NOT find GLPK (missing:  GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND) 
-- Could NOT find CPLEX (missing:  CPLEX_LIBRARY CPLEX_INCLUDE_DIR) 
-- Could NOT find OPENCL (missing:  OPENCL_LIBRARY) 
-- Looking for viennacl::ocl::type_to_string<char>::apply
-- Looking for viennacl::ocl::type_to_string<char>::apply - not found