SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RandomKitchenSinksDotFeatures.h
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2013 Evangelos Anagnostopoulos
00008  * Copyright (C) 2013 Evangelos Anagnostopoulos
00009  */
00010 
00011 #ifndef _RANDOMKITCHENSINKS_DOT_FEATURES_H__
00012 #define _RANDOMKITCHENSINKS_DOT_FEATURES_H__
00013 
00014 #include <shogun/features/DotFeatures.h>
00015 
00016 namespace shogun
00017 {
00018 
00044 class CRandomKitchenSinksDotFeatures : public CDotFeatures
00045 {
00046 public:
00047 
00049     CRandomKitchenSinksDotFeatures();
00050 
00058     CRandomKitchenSinksDotFeatures(CDotFeatures* dataset, int32_t K);
00059 
00066     CRandomKitchenSinksDotFeatures(CDotFeatures* dataset, int32_t K,
00067             SGMatrix<float64_t> coeff);
00068 
00073     CRandomKitchenSinksDotFeatures(CFile* loader);
00074 
00076     CRandomKitchenSinksDotFeatures(const CRandomKitchenSinksDotFeatures& orig);
00077 
00079     virtual CFeatures* duplicate() const;
00080 
00082     virtual ~CRandomKitchenSinksDotFeatures();
00083 
00091     virtual int32_t get_dim_feature_space() const;
00092 
00102     virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df,
00103             int32_t vec_idx2);
00104 
00113     virtual float64_t dense_dot(int32_t vec_idx1, float64_t* vec2,
00114             int32_t vec2_len);
00115 
00126     virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1,
00127             float64_t* vec2, int32_t vec2_len, bool abs_val = false);
00128 
00134     virtual int32_t get_nnz_features_for_vector(int32_t num);
00135 
00147     virtual void* get_feature_iterator(int32_t vector_index);
00148 
00161     virtual bool get_next_feature(int32_t& index, float64_t& value,
00162             void* iterator);
00163 
00169     virtual void free_feature_iterator(void* iterator);
00170 
00175     virtual EFeatureType get_feature_type() const;
00176 
00181     virtual EFeatureClass get_feature_class() const;
00182 
00187     virtual int32_t get_num_vectors() const;
00188 
00194     SGMatrix<float64_t> generate_random_coefficients();
00195 
00200     SGMatrix<float64_t> get_random_coefficients();
00201 
00203     const char* get_name() const;
00204 
00205 protected:
00212     virtual float64_t dot(index_t vec_idx, index_t par_idx);
00213 
00221     virtual float64_t post_dot(float64_t dot_result, index_t par_idx);
00222 
00227     virtual SGVector<float64_t> generate_random_parameter_vector()=0;
00228 private:
00229     void init(CDotFeatures* dataset, int32_t K);
00230 
00231 protected:
00232 
00234     CDotFeatures* feats;
00235 
00237     int32_t num_samples;
00238 
00240     SGMatrix<float64_t> random_coeff;
00241 };
00242 }
00243 
00244 #endif // _RANDOMKITCHENSINKS_DOT_FEATURES_H__
00245 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation