File feature_vector_nominal.hpp

class NominalFeatureVector : public CompressedVector
#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

using value_type = int32

The type of the values, the view provides access to.

using value_const_iterator = const int32*

An iterator that provides read-only access to all nominal values.

using value_iterator = int32*

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 values

  • indices – A pointer to an array of type uint32, shape (numIndices) that stores the indices of all examples not associated with the majority value

  • indptr – A pointer to an array that stores the indices of the first element in indices that corresponds to a certain value in values

  • 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() override
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

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

Public Members

int32 *values

A pointer to an array that stores all nominal values.

int32 majorityValue

The majority value, i.e., the most frequent value, of the nominal feature.