SHOGUN
v1.1.0
|
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) 2011 Shashwat Lal Das 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society 00009 */ 00010 #ifndef _STREAMING_DOTFEATURES__H__ 00011 #define _STREAMING_DOTFEATURES__H__ 00012 00013 #include <shogun/lib/common.h> 00014 #include <shogun/features/StreamingFeatures.h> 00015 #include <shogun/features/DotFeatures.h> 00016 #include <shogun/io/StreamingFile.h> 00017 00018 namespace shogun 00019 { 00042 class CStreamingDotFeatures : public CStreamingFeatures 00043 { 00044 00045 public: 00047 CStreamingDotFeatures(); 00048 00056 CStreamingDotFeatures(CStreamingFile* file, bool is_labelled, int32_t size); 00057 00070 CStreamingDotFeatures(CDotFeatures* dot_features, float64_t* lab=NULL); 00071 00072 virtual ~CStreamingDotFeatures(); 00073 00080 virtual float32_t dot(CStreamingDotFeatures* df)=0; 00081 00087 virtual float32_t dense_dot(const float32_t* vec2, int32_t vec2_len)=0; 00088 00106 virtual void dense_dot_range(float32_t* output, float32_t* alphas, 00107 float32_t* vec, int32_t dim, float32_t b, int32_t num_vec=0); 00108 00116 virtual void add_to_dense_vec(float32_t alpha, float32_t* vec2, 00117 int32_t vec2_len, bool abs_val=false)=0; 00118 00127 virtual void expand_if_required(float32_t*& vec, int32_t &len); 00128 00137 virtual void expand_if_required(float64_t*& vec, int32_t &len); 00138 00146 virtual int32_t get_dim_feature_space() const=0; 00147 00154 virtual void* get_feature_iterator(); 00155 00162 virtual int32_t get_nnz_features_for_vector(); 00163 00174 virtual bool get_next_feature(int32_t& index, float32_t& value, void* iterator); 00175 00181 virtual void free_feature_iterator(void* iterator); 00182 00183 private: 00184 virtual void init(); 00185 00186 virtual void init(CStreamingFile *file, bool is_labelled, int32_t size); 00187 00188 00189 00190 protected: 00191 00193 float32_t combined_weight; 00194 }; 00195 } 00196 #endif // _STREAMING_DOTFEATURES__H__