File feature_vector_binned.hpp

class BinnedFeatureVector : public CompressedVector
#include <feature_vector_binned.hpp>

A feature vector that stores the indices of the examples that are associated with each bin, except for the most frequent one, created by a method that assigns numerical feature values to bins.

Public Types

using threshold_type = float32

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

using threshold_const_iterator = const float32*

An iterator that provides read-only access to all thresholds.

using threshold_iterator = float32*

An iterator that provides access to all thresholds and allows to modify them.

Public Functions

BinnedFeatureVector(float32 *thresholds, uint32 *indices, uint32 *indptr, uint32 numBins, uint32 numIndices, uint32 sparseBinIndex)
Parameters:
  • thresholds – A pointer to an array of type float32, shape (numBins - 1) that stores thresholds separating bins

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

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

  • numBins – The number of bins, including the most frequent one

  • numIndices – The number of elements in the array indices

  • sparseBinIndex – The index of the most frequent bin

BinnedFeatureVector(const BinnedFeatureVector &other)
Parameters:

other – A reference to an object of type BinnedFeatureVector that should be copied

BinnedFeatureVector(BinnedFeatureVector &&other)
Parameters:

other – A reference to an object of type BinnedFeatureVector that should be moved

inline virtual ~BinnedFeatureVector() override
threshold_const_iterator thresholds_cbegin() const

Returns a threshold_const_iterator to the beginning of the thresholds.

Returns:

A threshold_const_iterator to the beginning

threshold_const_iterator thresholds_cend() const

Returns a value_const_iterator to the end of the thresholds.

Returns:

A value_const_iterator to the end

threshold_iterator thresholds_begin()

Returns a value_iterator to the beginning of the thresholds.

Returns:

A value_iterator to the beginning

threshold_iterator thresholds_end()

Returns a threshold_iterator to the end of the thresholds.

Returns:

A threshld_iterator to the end

threshold_type *releaseThresholds()

Releases the ownership of the array that stores the thresholds. 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 thresholds

Public Members

float32 *thresholds

A pointer to an array that stores thresholds separating adjacent bins.

uint32 sparseBinIndex

The index of the most frequent bin.