File feature_vector_nominal.hpp¶
-
class NominalFeatureVector¶
- #include <feature_vector_nominal.hpp>
A feature vector that stores the indices of the examples that are associated with each value, except for the majority value, i.e., the most frequent value, of a nominal feature.
Public Types
-
typedef const int32 *value_const_iterator¶
An iterator that provides read-only access to all nominal values.
-
typedef int32 *value_iterator¶
An iterator that provides access to all nominal values and allows to modify them.
Public Functions
-
NominalFeatureVector(int32 *values, uint32 *indices, uint32 *indptr, uint32 numValues, uint32 numIndices, int32 majorityValue)¶
- Parameters:
values – A pointer to an array of type
int32
, shape(numValues)
that stores all nominal valuesindices – A pointer to an array of type
uint32
, shape(numIndices)
that stores the indices of all examples not associated with the majority valueindptr – A pointer to an array that stores the indices of the first element in
indices
that corresponds to a certain value invalues
numValues – The number of elements in the array
values
numIndices – The number of elements in the array
indices
majorityValue – The majority value, i.e., the most frequent value, of the nominal feature
-
NominalFeatureVector(const NominalFeatureVector &other)¶
- Parameters:
other – A reference to an object of type
NominalFeatureVector
that should be copied
-
NominalFeatureVector(NominalFeatureVector &&other)¶
- Parameters:
other – A reference to an object of type
NominalFeatureVector
that should be moved
-
inline virtual ~NominalFeatureVector()¶
-
value_const_iterator values_cbegin() const¶
Returns a
value_const_iterator
to the beginning of the nominal values.- Returns:
A
value_const_iterator
to the beginning
-
value_const_iterator values_cend() const¶
Returns a
value_const_iterator
to the end of the nominal values.- Returns:
A
value_const_iterator
to the end
-
value_iterator values_begin()¶
Returns a
value_iterator
to the beginning of the nominal values.- Returns:
A
value_iterator
to the beginning
-
value_iterator values_end()¶
Returns a
value_iterator
to the end of the nominal values.- Returns:
A
value_iterator
to the end
-
index_const_iterator indices_cbegin(uint32 index) const¶
Returns an
index_const_iterator
to the beginning of the indices of the examples that are associated with a specific nominal value.- Parameters:
index – The index of the nominal value
- Returns:
An
index_const_iterator
to the beginning
-
index_const_iterator indices_cend(uint32 index) const¶
Returns an
index_const_iterator
to the end of the indices of the examples that are associated with a specific nominal value.- Parameters:
index – The index of the nominal value
- Returns:
An
index_const_iterator
to the end
-
index_iterator indices_begin(uint32 index)¶
Returns an
index_iterator
to the beginning of the indices of the examples that are associated with a specific nominal value.- Parameters:
index – The index of the nominal value
- Returns:
An
index_iterator
to the beginning
-
index_iterator indices_end(uint32 index)¶
Returns an
index_iterator
to the end of the indices of the examples that are associated with a specific nominal value.- Parameters:
index – The index of the nominal value
- Returns:
An
index_iterator
to the end
-
value_type *releaseValues()¶
Releases the ownership of the array that stores all nominal values. As a result, the behavior of this view becomes undefined and it should not be used anymore. The caller is responsible for freeing the memory that is occupied by the array.
- Returns:
A pointer to an array that stores all nominal values
-
index_type *releaseIndices()¶
Releases the ownership of the array that stores the indices of all examples not associated with the majority value. As a result, the behavior of this view becomes undefined and it should not be used anymore. The caller is responsible for freeing the memory that is occupied by the array.
- Returns:
A pointer to the array that stores the indices of all examples not associated with the majority value
-
index_type *releaseIndptr()¶
Releases the ownership of the array that stores the indices of the first element in
indices
that corresponds to a certain value invalues
. As a result, the behavior of this view becomes undefined and it should not be used anymore. The caller is responsible for freeing the memory that is occupied by the array.- Returns:
A pointer to an array that stores the indices of the first element in
indices
that corresponds to a certain value invalues
-
typedef const int32 *value_const_iterator¶