32     init(file, is_labelled, size);
 
   38     if (parser.is_running())
 
   45     ASSERT(index>=0 && index<current_num_features)
 
   46     return current_sgvector.get_feature(index);
 
   58     int32_t n=current_num_features;
 
   60     current_num_features=num;
 
   85     ASSERT(dim>=current_num_features)
 
   87     return current_sgvector.dense_dot(alpha, vec, dim, b);
 
   95     int32_t current_length = current_sgvector.num_feat_entries;
 
  101         for (int32_t i=0; i<current_length; i++) {
 
  102             if (current_vector[i].feat_index < vec2_len) {
 
  116     int32_t current_length = current_sgvector.num_feat_entries;
 
  122         for (int32_t i=0; i<current_length; i++) {
 
  123             if (current_vector[i].feat_index < vec2_len) {
 
  136     if (vec2_len < current_num_features)
 
  138         SG_ERROR(
"dimension of vec (=%d) does not match number of features (=%d)\n",
 
  139              vec2_len, current_num_features);
 
  143     int32_t num_feat=current_sgvector.num_feat_entries;
 
  149             for (int32_t i=0; i<num_feat; i++)
 
  150                 vec2[sv[i].feat_index]+= alpha*
CMath::abs(sv[i].entry);
 
  154             for (int32_t i=0; i<num_feat; i++)
 
  155                 vec2[sv[i].feat_index]+= alpha*sv[i].entry;
 
  164     if (vec2_len < current_num_features)
 
  166         SG_ERROR(
"dimension of vec (=%d) does not match number of features (=%d)\n",
 
  167              vec2_len, current_num_features);
 
  171     int32_t num_feat=current_sgvector.num_feat_entries;
 
  177             for (int32_t i=0; i<num_feat; i++)
 
  178                 vec2[sv[i].feat_index]+= alpha*
CMath::abs(sv[i].entry);
 
  182             for (int32_t i=0; i<num_feat; i++)
 
  183                 vec2[sv[i].feat_index]+= alpha*sv[i].entry;
 
  191     return current_sgvector.num_feat_entries;
 
  197     int32_t current_length = current_sgvector.num_feat_entries;
 
  204     for (int32_t i=0; i<current_length; i++)
 
  205         sq += current_vector[i].entry * current_vector[i].entry;
 
  217     get_vector().sort_features(
true);
 
  219     ASSERT(old_ptr == current_sgvector.features);
 
  231     if (current_sgvector.features)
 
  243     parser.set_read_vector_and_label
 
  247 #define GET_FEATURE_TYPE(f_type, sg_type)               \ 
  248 template<> EFeatureType CStreamingSparseFeatures<sg_type>::get_feature_type() const \ 
  266 #undef GET_FEATURE_TYPE 
  270 void CStreamingSparseFeatures<T>::init()
 
  274     current_num_features=-1;
 
  280 void CStreamingSparseFeatures<T>::init(CStreamingFile* file,
 
  285     has_labels = is_labelled;
 
  288     parser.init(file, is_labelled, size);
 
  289     parser.set_free_vector_after_release(
false);
 
  295     if (!parser.is_running())
 
  296         parser.start_parser();
 
  308     int32_t current_length = 0;
 
  312     ret_value = (bool) parser.get_next_example(current_vector,
 
  324     current_num_features = 
CMath::max(current_num_features, current_dimension);
 
  333     return current_sgvector;
 
  341     return current_label;
 
  347     parser.finalize_example();
 
  353     return current_num_features;
 
  366     return current_num_features;
 
  372     return current_sgvector.num_feat_entries;
 
virtual void set_vector_reader()
T sparse_dot(const SGSparseVector< T > &v)
int64_t get_num_nonzero_entries()
T get_feature(int32_t index)
#define SG_NOTIMPLEMENTED
virtual void add_to_dense_vec(float64_t alpha, float64_t *vec2, int32_t vec2_len, bool abs_val=false)
virtual void start_parser()
SGSparseVector< T > get_vector()
virtual int32_t get_num_features()
CStreamingSparseFeatures()
static T sparse_dot(T alpha, SGSparseVectorEntry< T > *avec, int32_t alen, SGSparseVectorEntry< T > *bvec, int32_t blen)
EFeatureClass
shogun feature class 
virtual void reset_stream()
float32_t compute_squared()
A Streaming File access class. 
virtual float32_t dot(CStreamingDotFeatures *df)
virtual int32_t get_nnz_features_for_vector()
virtual int32_t get_dim_feature_space() const 
virtual void get_sparse_vector_and_label(SGSparseVectorEntry< bool > *&vector, int32_t &len, float64_t &label)
virtual CFeatures * duplicate() const 
Streaming features that support dot products among other operations. 
virtual int32_t get_num_vectors() const 
virtual EFeatureClass get_feature_class() const 
all of classes and functions are contained in the shogun namespace 
virtual float64_t get_label()
void set_read_functions()
virtual void end_parser()
virtual void get_sparse_vector(SGSparseVectorEntry< bool > *&vector, int32_t &len)
template class SGSparseVectorEntry 
virtual bool get_next_example()
int32_t set_num_features(int32_t num)
The class Features is the base class of all feature objects. 
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry* vector is orde...
#define GET_FEATURE_TYPE(f_type, sg_type)
virtual void set_vector_and_label_reader()
int32_t get_num_dimensions()
T dense_dot(T alpha, T *vec, int32_t dim, T b)
This class implements streaming features with sparse feature vectors. The vector is represented as an...
virtual void release_example()
virtual ~CStreamingSparseFeatures()