14 #ifndef _SPARSEFEATURES__H__
15 #define _SPARSEFEATURES__H__
33 template <
class ST>
class CDenseFeatures;
155 ST
dense_dot(ST alpha, int32_t num, ST* vec, int32_t dim, ST b);
169 float64_t* vec, int32_t dim,
bool abs_val=
false);
415 #ifndef DOXYGEN_SHOULD_SKIP_THIS
417 struct sparse_feature_iterator
423 int32_t vector_index;
431 SG_SPRINT(
"sv=%p, vidx=%d, num_feat_entries=%d, index=%d\n",
478 virtual const char*
get_name()
const {
return "SparseFeatures"; }
CSparseFeatures(int32_t size=0)
The class DenseFeatures implements dense feature matrices.
ST dense_dot(ST alpha, int32_t num, ST *vec, int32_t dim, ST b)
int32_t set_num_features(int32_t num)
CFeatures(int32_t size=0)
virtual const char * get_name() const
Template class SparseFeatures implements sparse matrices.
virtual CFeatures * duplicate() const
virtual ~CSparseFeatures()
int64_t get_num_nonzero_entries()
Features that support dot products among other operations.
EFeatureClass
shogun feature class
float64_t compute_squared_norm(CSparseFeatures< float64_t > *lhs, float64_t *sq_lhs, int32_t idx_a, CSparseFeatures< float64_t > *rhs, float64_t *sq_rhs, int32_t idx_b)
ST get_feature(int32_t num, int32_t index)
SGSparseMatrix< ST > get_sparse_feature_matrix()
void set_sparse_feature_matrix(SGSparseMatrix< ST > sm)
virtual SGSparseVectorEntry< ST > * compute_sparse_feature_vector(int32_t num, int32_t &len, SGSparseVectorEntry< ST > *target=NULL)
void free_sparse_features()
CSparseFeatures< ST > * get_transposed()
int32_t get_num_features() const
SGSparseMatrix< ST > sparse_feature_matrix
array of sparse vectors of size num_vectors
virtual bool get_next_feature(int32_t &index, float64_t &value, void *iterator)
virtual EFeatureClass get_feature_class() const
SGVector< ST > get_full_feature_vector(int32_t num)
CCache< SGSparseVectorEntry< ST > > * feature_cache
virtual void free_feature_iterator(void *iterator)
A File access base class.
virtual void set_full_feature_matrix(SGMatrix< ST > full)
void obtain_from_simple(CDenseFeatures< ST > *sf)
void save_with_labels(CLibSVMFile *writer, SGVector< float64_t > labels)
virtual void * get_feature_iterator(int32_t vector_index)
void free_feature_vector(int32_t num)
virtual EFeatureType get_feature_type() const
SGSparseVectorEntry< T > * features
void free_sparse_feature_vector(int32_t num)
SGSparseVector< ST > get_sparse_feature_vector(int32_t num)
EFeatureType
shogun feature type
virtual bool apply_preprocessor(bool force_preprocessing=false)
virtual int32_t get_dim_feature_space() const
all of classes and functions are contained in the shogun namespace
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)
read sparse real valued features in svm light format e.g. -1 1:10.0 2:100.2 1000:1.3 with -1 == (optional) label and dim 1 - value 10.0 dim 2 - value 100.2 dim 1000 - value 1.3
Template class Cache implements a simple cache.
The class Features is the base class of all feature objects.
float64_t * compute_squared(float64_t *sq)
void add_to_dense_vec(float64_t alpha, int32_t num, float64_t *vec, int32_t dim, bool abs_val=false)
virtual CFeatures * copy_subset(SGVector< index_t > indices)
SGVector< float64_t > load_with_labels(CLibSVMFile *loader)
SGMatrix< ST > get_full_feature_matrix()
virtual int32_t get_num_vectors() const
void free_sparse_feature_matrix()
virtual int32_t get_nnz_features_for_vector(int32_t num)