15 using namespace shogun;
33 "void CRandomFourierGaussPreproc::copy(...): feats.randomcoeff_additive==NULL && cur_dim_feature_space>0 \n");
49 "void CRandomFourierGaussPreproc::copy(...): feats.randomcoeff_multiplicative==NULL && cur_dim_feature_space>0 &&(cur_dim_input_space>0) \n");
140 "void CRandomFourierGaussPreproc::set_dim_feature_space(const int32 dim): dim<=0 is not allowed");
152 if (kernelwidth2 <= 0) {
154 "void CRandomFourierGaussPreproc::set_kernelwidth(const float64_t kernelwidth2 ): kernelwidth2 <= 0 is not allowed");
166 "void CRandomFourierGaussPreproc::set_dim_input_space(const int32 dim): dim<=0 is not allowed");
192 "bool CRandomFourierGaussPreproc::init_randomcoefficients(): dim_feature_space<=0 is not allowed\n");
196 "bool CRandomFourierGaussPreproc::init_randomcoefficients(): dim_input_space<=0 is not allowed\n");
204 SG_INFO(
"initializing randomcoefficients \n") ;
242 SG_INFO(
"finished: initializing randomcoefficients \n") ;
249 float64_t ** randomcoeff_multiplicative2, int32_t *dim_feature_space2,
250 int32_t *dim_input_space2,
float64_t* kernelwidth2)
const {
252 ASSERT(randomcoeff_additive2);
253 ASSERT(randomcoeff_multiplicative2);
256 *dim_feature_space2 = 0;
257 *dim_input_space2 = 0;
259 *randomcoeff_additive2 = NULL;
260 *randomcoeff_multiplicative2 = NULL;
272 *randomcoeff_additive2);
274 *randomcoeff_multiplicative2);
282 const int32_t dim_feature_space2,
const int32_t dim_input_space2,
const float64_t kernelwidth2) {
301 std::copy(randomcoeff_additive2, randomcoeff_additive2
303 std::copy(randomcoeff_multiplicative2, randomcoeff_multiplicative2
312 "CRandomFourierGaussPreproc::init (CFeatures *f) requires CSimpleFeatures<float64_t> as features\n");
316 "CRandomFourierGaussPreproc::init (CFeatures *f) requires CSimpleFeatures<float64_t> as features\n");
320 "CRandomFourierGaussPreproc::init (CFeatures *f): dim_feature_space<=0 is not allowed, use void set_dim_feature_space(const int32 dim) before!\n");
323 SG_INFO(
"calling CRandomFourierGaussPreproc::init(...)\n");
324 int32_t num_features =
345 "float64_t * CRandomFourierGaussPreproc::apply_to_feature_vector(...): test_rfinited()==false: you need to call before CRandomFourierGaussPreproc::init (CFeatures *f) OR 1. set_dim_feature_space(const int32 dim), 2. set_dim_input_space(const int32 dim), 3. init_randomcoefficients() or set_randomcoefficients(...) \n");
365 int32_t num_vectors = 0;
366 int32_t num_features = 0;
368 num_features, num_vectors);
369 SG_INFO(
"get Feature matrix: %ix%i\n", num_vectors, num_features);
374 "float64_t * CRandomFourierGaussPreproc::apply_to_feature_matrix(CFeatures *f): num_features!=cur_dim_input_space is not allowed\n");
381 "CRandomFourierGaussPreproc::apply_to_feature_matrix(...): memory allocation failed \n");
385 for (int32_t vec = 0; vec < num_vectors; vec++) {
391 cur_dim_input_space));
395 cur_dim_feature_space, num_vectors);
398 num_features, num_vectors);
399 ASSERT(num_features==cur_dim_feature_space);
float64_t * randomcoeff_multiplicative
virtual EFeatureType get_feature_type()=0
int32_t cur_dim_input_space
void set_dim_feature_space(const int32_t dim)
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
int32_t get_dim_input_space() const
int32_t dim_feature_space
virtual SGVector< float64_t > apply_to_feature_vector(SGVector< float64_t > vector)
float64_t * randomcoeff_additive
float64_t cur_kernelwidth
virtual bool init(CFeatures *f)
bool init_randomcoefficients()
EFeatureClass
shogun feature class
~CRandomFourierGaussPreproc()
virtual EFeatureType get_feature_type()
void add(bool *param, const char *name, const char *description="")
CRandomFourierGaussPreproc()
int32_t cur_dim_feature_space
virtual EFeatureClass get_feature_class()=0
void set_randomcoefficients(float64_t *randomcoeff_additive2, float64_t *randomcoeff_multiplicative2, const int32_t dim_feature_space2, const int32_t dim_input_space2, const float64_t kernelwidth2)
bool test_rfinited() const
void set_kernelwidth(const float64_t width)
float64_t get_kernelwidth() const
int32_t get_dim_feature_space() const
void copy(const CRandomFourierGaussPreproc &feats)
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
compute dot product between v1 and v2 (blas optimized)
EFeatureType
shogun feature type
virtual EFeatureClass get_feature_class()
void add_vector(bool **param, index_t *length, const char *name, const char *description="")
The class Features is the base class of all feature objects.
void set_dim_input_space(const int32_t dim)
static float64_t log(float64_t v)
Preprocessor CRandomFourierGaussPreproc implements Random Fourier Features for the Gauss kernel a la ...
static float32_t sqrt(float32_t x)
x^0.5
void add_matrix(bool **param, index_t *length_y, index_t *length_x, const char *name, const char *description="")
void get_randomcoefficients(float64_t **randomcoeff_additive2, float64_t **randomcoeff_multiplicative2, int32_t *dim_feature_space2, int32_t *dim_input_space2, float64_t *kernelwidth2) const
Template class SimplePreprocessor, base class for preprocessors (cf. CPreprocessor) that apply to CSi...
#define SG_MALLOC(type, len)
virtual SGMatrix< float64_t > apply_to_feature_matrix(CFeatures *features)
static T abs(T a)
return the absolute value of a number