kernel_matrix in https://github.com/shogun-toolbox/shogun/blob/develop/src/shogun/statistical_testing/QuadraticTimeMMD.cpp#L323
matrix=[[ 1, 0.357435345649719238, 0.881105303764343262, 0.264614194631576538, 0.392460733652114868, 0.29888606071472168, 0.77649921178817749, 0.392304211854934692, 0.415194451808929443, 0.284810483455657959, 0.0661987736821174622, 0.264099746942520142, 0.346782028675079346, 0.25590476393699646, 0.805517375469207764, 0.192790955305099487, 0.913285493850708008, 0.15366363525390625, 0.567021012306213379, 0.133734241127967834, 0.071564696729183197, 0.596106052398681641, 0.146366193890571594, 0.281917452812194824, 0.639549732208251953, 0.213880911469459534, 0.372015953063964844, 0.911623120307922363, 0.0226767528802156448, 0.0492779314517974854, 0.150228172540664673, 0.182678699493408203, 0.194619730114936829, 0.223039060831069946, 0.0562533959746360779, 0.177665024995803833, 0.0953366979956626892, 0.427403718233108521, 0.805513143539428711, 0.11347990483045578, 0.101488135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loat64_t CQuadraticTimeMMD::compute_statistic() | |
{ | |
... | |
if (self->precompute) | |
{ | |
SGMatrix<float32_t> kernel_matrix=self->get_kernel_matrix(); | |
statistic=self->statistic_job(kernel_matrix); | |
SG_PRINT("kernel_matrix is"); // output is in https://pastebin.mozilla.org/9026733 | |
kernel_matrix.display_matrix(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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/multiclass/ecoc/ECOCHDDecoder.h> | |
#include <shogun/features/DenseFeatures.h> | |
#include <shogun/multiclass/ecoc/ECOCStrategy.h> | |
#include <shogun/multiclass/ecoc/ECOCRandomDenseEncoder.h> | |
#include <shogun/machine/LinearMulticlassMachine.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "spdlog/spdlog.h" | |
class SGIO | |
{ | |
public: | |
SGIO | |
{ | |
... | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in init.hpp | |
__init32_t global_random_seed = CRandom::generate_seed(); | |
// in CRanomd.hpp | |
extern __init32_t global_random_seed; | |
CRandom::CRandom() : m_sfmt_32(NULL), | |
m_sfmt_64(NULL),m_dsfmt(NULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CSGObject | |
{ | |
public: | |
void CSGObject::init() | |
{ | |
m_rng = std::unique_ptr<CRandom>(new CRandom(m_seed)); | |
} | |
static void set_global_seed(uint32_t seed) | |
{ | |
CSGObject::m_seed = seed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CNeuralNetwork::set_seed(int32_t seed) | |
{ | |
m_rng->set_seed(seed); | |
for (int32_t i=0; i<m_num_layers; i++) | |
{ | |
get_layer(i)->set_seed(seed); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST(BinaryLabels, serialization) | |
{ | |
CBinaryLabels* labels=new CBinaryLabels(10); | |
labels->set_values(SGVector<float64_t>(labels->get_num_labels())); | |
for (index_t i=0; i<labels->get_num_labels(); ++i) | |
labels->set_value(i%2==0 ? 1 : -1, i); | |
/* generate file name */ |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.