Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vigsterkr
vigsterkr / ShogunML_n_SciRuby.ipynb
Created February 1, 2020 09:08
ShogunML with SciRuby stack
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class CSGObject {
public:
static void set_seed(uint32_t seed) {
CSGObject::m_seed = seed;
}
private:
static uint32_t m_seed;
}
[]() { auto rng = std::unique_ptr<CRandom>(new CRandom()); return rng->random(); }
@vigsterkr
vigsterkr / gp_classifier.cc
Created June 24, 2017 05:56
shogunboard - aka monitoring shogun models with tensorboard
#include <shogun/base/init.h>
#include <shogun/base/some.h>
#include <shogun/labels/MulticlassLabels.h>
#include <shogun/lib/SGVector.h>
#include <shogun/io/SerializableAsciiFile.h>
#include <shogun/machine/gp/SoftMaxLikelihood.h>
#include <shogun/kernel/GaussianKernel.h>
#include <shogun/classifier/GaussianProcessClassification.h>
#include <shogun/mathematics/Math.h>
#include <shogun/features/DenseFeatures.h>
@vigsterkr
vigsterkr / random.h
Last active June 21, 2017 10:15
new random in shogun prototype
template <typename RandomEngine = std::mt19937> class CRandom {
public:
CRandom() {
}
CRandom(uint32_t seed);
~CRandom();
int32_t random(int32_t from, int32_t to) const
{
@vigsterkr
vigsterkr / DynamicArray.h
Last active June 20, 2017 08:06
how to fix serialization of std::vector
virtual void load_serializable_post() throw (ShogunException)
{
CSGObject::load_serializable_post();
m_array.assign(m_array_content, m_array_content+num_elements);
SG_FREE(m_array_content);
m_array.shrink_to_fit();
}
/** Can (optionally) be overridden to pre-initialize some member
* variables which are not PARAMETER::ADD'ed. Make sure that at
@vigsterkr
vigsterkr / gist:6f75563c64f62b33b4ac7d0e09ab22d5
Last active April 24, 2017 09:42
Heiko is worrie that we will loose it :)
// Immutable features
// linear model
- dot prod:
- pairs
-
- cov var matrix: there's a Feature operator => CovarView => matrix
-
@vigsterkr
vigsterkr / clone_unittest.cc.jinja2
Created August 23, 2013 11:54
new clone_equals test
TEST(SGObject,clone_equals_{{class}})
{
const char* class_name="{{class}}";
CSGObject* object = new_sgserializable(class_name, PT_NOT_GENERIC);
ASSERT_TRUE(object != NULL);
/* test for get_name() */
ASSERT_TRUE(strcmp(object->get_name(), class_name) == 0);
/* test for .equals() */
cd /Users/wiking/shogun/build/src/interfaces/python_modular && /usr/bin/c++ -DDSFMT_MEXP=19937 -DHAVE_ARPACK -DHAVE_DOXYGEN -DHAVE_EIGEN3 -DHAVE_HDF5 -DHAVE_JSON -DHAVE_LAPACK -DHAVE_LARGEFILE -DHAVE_LGAMMAL -DHAVE_LOG2 -DHAVE_POWL -DHAVE_PTHREAD -DHAVE_SQRTL -DHAVE_XML -DSFMT_MEXP=19937 -DUSE_BIGSTATES -DUSE_BOOL -DUSE_BZIP2 -DUSE_CHAR -DUSE_FLOAT32 -DUSE_FLOAT64 -DUSE_FLOATMAX -DUSE_GLPK -DUSE_GZIP -DUSE_HMMCACHE -DUSE_INT16 -DUSE_INT32 -DUSE_INT64 -DUSE_INT8 -DUSE_LZMA -DUSE_LZO -DUSE_REFERENCE_COUNTING -DUSE_SHORTREAL_KERNELCACHE -DUSE_SNAPPY -DUSE_SVMLIGHT -DUSE_UINT16 -DUSE_UINT32 -DUSE_UINT64 -DUSE_UINT8 -D_python_modular_EXPORTS -g -fPIC -I/opt/local/include -I/opt/local/lib/../include -I/opt/local/include/eigen3 -I/opt/local/include/json -I/opt/local/include/libxml2 -I/System/Library/Frameworks/Python.framework/Headers -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/Users/wiking/shogun/src -o CMakeFiles/_python_modular.dir/modshogunPYTHON_wrap.c