/usr/include/shogun/features/CombinedFeatures.h is in libshogun-dev 3.2.0-7.3build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 1999-2009 Soeren Sonnenburg
* Written (W) 1999-2008 Gunnar Raetsch
* Written (W) 2012 Heiko Strathmann
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/
#ifndef _CCOMBINEDFEATURES__H__
#define _CCOMBINEDFEATURES__H__
#include <shogun/features/Features.h>
#include <shogun/lib/DynamicObjectArray.h>
namespace shogun
{
class CFeatures;
class CDynamicObjectArray;
/** @brief The class CombinedFeatures is used to combine a number of of feature objects
* into a single CombinedFeatures object.
*
* It keeps pointers to the added sub-features and is especially useful to
* combine kernels working on different domains (c.f. CCombinedKernel) and to
* combine kernels looking at independent features.
*
* Subsets are supported: All actions will just be given through to all
* sub-features. Only once per sub-feature instance, i.e. if there are two
* sub-features that are the same instance, the subset action will only be
* performed once.
*/
class CCombinedFeatures : public CFeatures
{
public:
/** default constructor */
CCombinedFeatures();
/** copy constructor */
CCombinedFeatures(const CCombinedFeatures& orig);
/** duplicate feature object
*
* @return feature object
*/
virtual CFeatures* duplicate() const;
/** destructor */
virtual ~CCombinedFeatures();
/** get feature type
*
* @return feature type UNKNOWN
*/
virtual EFeatureType get_feature_type() const
{
return F_UNKNOWN;
}
/** get feature class
*
* @return feature class SIMPLE
*/
virtual EFeatureClass get_feature_class() const
{
return C_COMBINED;
}
/** get number of feature vectors
*
* @return number of feature vectors
*/
virtual int32_t get_num_vectors() const
{
return m_subset_stack->has_subsets()
? m_subset_stack->get_size() : num_vec;
}
/** list feature objects */
void list_feature_objs();
/** check feature object compatibility
*
* @param comb_feat feature to check for compatibility
* @return if feature is compatible
*/
bool check_feature_obj_compatibility(CCombinedFeatures* comb_feat);
/** get first feature object
*
* @return first feature object
*/
CFeatures* get_first_feature_obj();
/** get feature object at index idx
*
* @param idx index of feature object
* @return the feature object at index idx
*/
CFeatures* get_feature_obj(int32_t idx);
/** get last feature object
*
* @return last feature object
*/
CFeatures* get_last_feature_obj();
/** insert feature object at index idx
* Important, idx must be < num_feature_obj
*
* @param obj feature object to insert
* @param idx the index where to insert the feature object
* @return if inserting was successful
*/
bool insert_feature_obj(CFeatures* obj, int32_t idx);
/** append feature object to the end of this CombinedFeatures object array
*
* @param obj feature object to append
* @return if appending was successful
*/
bool append_feature_obj(CFeatures* obj);
/** delete feature object at position idx
*
* @param idx the index of the feature object to delete
* @return if deleting was successful
*/
bool delete_feature_obj(int32_t idx);
/** get number of feature objects
*
* @return number of feature objects
*/
int32_t get_num_feature_obj();
/** Takes another feature instance and returns a new instance which is
* a concatenation of a copy if this instace's data and the given
* instance's data. Note that the feature types have to be equal.
*
* In this case, all sub features are merged
*
* @param other feature object to append
* @return new feature object which contains copy of data of this
* instance and of given one
*/
CFeatures* create_merged_copy(CFeatures* other);
/** adds a subset of indices on top of the current subsets (possibly
* subset o subset. Calls subset_changed_post() afterwards.
* Adds the subset to all sub-features
*
* @param subset subset of indices to add
* */
virtual void add_subset(SGVector<index_t> subset);
/** removes that last added subset from subset stack, if existing
* Calls subset_changed_post() afterwards
*
* Removes the subset from all sub-features
* */
virtual void remove_subset();
/** removes all subsets
* Calls subset_changed_post() afterwards
*
* Removes all subsets of all sub-features
* */
virtual void remove_all_subsets();
/** Creates a new CFeatures instance containing copies of the elements
* which are specified by the provided indices.
* Simply creates a combined features instance where all sub-features
* are the results of their copy_subset calls
*
* @param indices indices of feature elements to copy
* @return new CFeatures instance with copies of feature data
*/
virtual CFeatures* copy_subset(SGVector<index_t> indices);
/** @return object name */
virtual const char* get_name() const { return "CombinedFeatures"; }
private:
void init();
protected:
/** feature array */
CDynamicObjectArray* feature_array;
/** number of vectors
* must match between sub features
*/
int32_t num_vec;
};
}
#endif
|