SHOGUN  3.2.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
CombinedDotFeatures.h
浏览该文件的文档.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2009-2010 Soeren Sonnenburg
8  * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  * Copyright (C) 2010 Berlin Institute of Technology
10  *
11  */
12 
13 #ifndef _COMBINEDDOTFEATURES_H___
14 #define _COMBINEDDOTFEATURES_H___
15 
16 #include <shogun/lib/common.h>
19 
20 namespace shogun
21 {
22 class CFeatures;
23 class CDynamicObjectArray;
44 {
45  public:
48 
51 
53  virtual ~CCombinedDotFeatures();
54 
59  virtual int32_t get_num_vectors() const
60  {
61  return num_vectors;
62  }
63 
68  virtual int32_t get_dim_feature_space() const
69  {
70  return num_dimensions;
71  }
72 
80  virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2);
81 
88  virtual float64_t dense_dot(int32_t vec_idx1, const float64_t* vec2, int32_t vec2_len);
89 
101  virtual void dense_dot_range(float64_t* output, int32_t start,
102  int32_t stop, float64_t* alphas, float64_t* vec,
103  int32_t dim, float64_t b);
104 
116  virtual void dense_dot_range_subset(int32_t* sub_index, int32_t num,
117  float64_t* output, float64_t* alphas, float64_t* vec,
118  int32_t dim, float64_t b);
119 
128  virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1,
129  float64_t* vec2, int32_t vec2_len, bool abs_val=false);
130 
136  virtual int32_t get_nnz_features_for_vector(int32_t num);
137 
143  {
144  return F_DREAL;
145  }
146 
152  {
153  return C_COMBINED_DOT;
154  }
155 
156  #ifndef DOXYGEN_SHOULD_SKIP_THIS
157 
158  struct combined_feature_iterator
159  {
161  CDotFeatures* f;
163  void* iterator;
165  int32_t vector_index;
166  };
167  #endif
168 
178  virtual void* get_feature_iterator(int32_t vector_index);
179 
190  virtual bool get_next_feature(int32_t& index, float64_t& value, void* iterator);
191 
197  virtual void free_feature_iterator(void* iterator);
198 
203  virtual CFeatures* duplicate() const;
204 
206  void list_feature_objs();
207 
213  CDotFeatures* get_feature_obj(int32_t idx);
214 
222  bool insert_feature_obj(CDotFeatures* obj, int32_t idx);
223 
229  bool append_feature_obj(CDotFeatures* obj);
230 
236  bool delete_feature_obj(int32_t idx);
237 
242  int32_t get_num_feature_obj();
243 
247  virtual SGVector<float64_t> get_subfeature_weights();
248 
253  virtual void set_subfeature_weights(SGVector<float64_t> weights);
254 
256  virtual const char* get_name() const { return "CombinedDotFeatures"; }
257 
258  protected:
261 
262  private:
263  void init();
264 
265  protected:
268 
270  int32_t iterator_idx;
272  int32_t num_vectors;
274  int32_t num_dimensions;
275 };
276 }
277 #endif // _DOTFEATURES_H___
int32_t iterator_idx
idx for iterator
CDynamicObjectArray * feature_array
int32_t num_vectors
total number of vectors
virtual int32_t get_dim_feature_space() const
virtual void dense_dot_range(float64_t *output, int32_t start, int32_t stop, float64_t *alphas, float64_t *vec, int32_t dim, float64_t b)
virtual bool get_next_feature(int32_t &index, float64_t &value, void *iterator)
CDotFeatures(int32_t size=0)
Definition: DotFeatures.cpp:42
bool insert_feature_obj(CDotFeatures *obj, int32_t idx)
virtual void set_subfeature_weights(SGVector< float64_t > weights)
CFeatures(int32_t size=0)
Definition: Features.cpp:23
virtual void dense_dot_range_subset(int32_t *sub_index, int32_t num, float64_t *output, float64_t *alphas, float64_t *vec, int32_t dim, float64_t b)
virtual CFeatures * duplicate() const
Features that support dot products among other operations.
Definition: DotFeatures.h:41
bool append_feature_obj(CDotFeatures *obj)
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:35
virtual EFeatureType get_feature_type() const
virtual SGVector< float64_t > get_subfeature_weights()
virtual EFeatureClass get_feature_class() const
virtual int32_t get_num_vectors() const
virtual const char * get_name() const
virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false)
double float64_t
Definition: common.h:48
CDotFeatures * get_feature_obj(int32_t idx)
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
virtual int32_t get_nnz_features_for_vector(int32_t num)
EFeatureType
shogun feature type
Definition: FeatureTypes.h:16
Features that allow stacking of a number of DotFeatures.
virtual void free_feature_iterator(void *iterator)
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)
virtual void * get_feature_iterator(int32_t vector_index)
int32_t num_dimensions
total number of dimensions
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)

SHOGUN 机器学习工具包 - 项目文档