OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
opennn::Histogram Struct Reference

Frequency histogram with per-bin minimums, maximums, centers, and counts. More...

#include <statistics.h>

Public Member Functions

 Histogram (const Index=0)
 Constructs an empty histogram with the given number of bins.
 
 Histogram (const VectorR &, const VectorR &)
 Constructs a histogram from precomputed bin centers and frequencies.
 
 Histogram (const VectorR &, const VectorR &, const VectorR &, const VectorR &)
 Constructs a histogram from bin minimums, maximums, centers, and frequencies.
 
 Histogram (const VectorR &, Index)
 Builds a histogram of the data with the given number of equal-width bins.
 
 Histogram (const VectorR &)
 Builds a histogram of the data using a default bin count.
 
Index get_bins_number () const
 Returns the number of bins in the histogram.
 
Index count_empty_bins () const
 Returns the number of bins with zero frequency.
 
Index calculate_minimum_frequency () const
 Returns the smallest bin frequency.
 
Index calculate_maximum_frequency () const
 Returns the largest bin frequency.
 
Index calculate_most_populated_bin () const
 Returns the index of the bin with the largest frequency.
 
VectorR calculate_minimal_centers () const
 Returns the centers of all bins tied for the minimum frequency.
 
VectorR calculate_maximal_centers () const
 Returns the centers of all bins tied for the maximum frequency.
 
Index calculate_bin (const float) const
 Returns the bin index that contains the given value.
 
Index calculate_frequency (const float) const
 Returns the frequency of the bin that contains the given value.
 
void save (const filesystem::path &) const
 Saves the histogram (centers and frequencies) to a text file.
 

Public Attributes

VectorR minimums
 
VectorR maximums
 
VectorR centers
 
VectorR frequencies
 

Detailed Description

Frequency histogram with per-bin minimums, maximums, centers, and counts.

Constructor & Destructor Documentation

◆ Histogram() [1/5]

opennn::Histogram::Histogram ( const Index = 0)

Constructs an empty histogram with the given number of bins.

◆ Histogram() [2/5]

opennn::Histogram::Histogram ( const VectorR & ,
const VectorR &  )

Constructs a histogram from precomputed bin centers and frequencies.

◆ Histogram() [3/5]

opennn::Histogram::Histogram ( const VectorR & ,
const VectorR & ,
const VectorR & ,
const VectorR &  )

Constructs a histogram from bin minimums, maximums, centers, and frequencies.

◆ Histogram() [4/5]

opennn::Histogram::Histogram ( const VectorR & ,
Index  )

Builds a histogram of the data with the given number of equal-width bins.

◆ Histogram() [5/5]

opennn::Histogram::Histogram ( const VectorR & )

Builds a histogram of the data using a default bin count.

Member Function Documentation

◆ calculate_bin()

Index opennn::Histogram::calculate_bin ( const float ) const
nodiscard

Returns the bin index that contains the given value.

◆ calculate_frequency()

Index opennn::Histogram::calculate_frequency ( const float ) const
nodiscard

Returns the frequency of the bin that contains the given value.

◆ calculate_maximal_centers()

VectorR opennn::Histogram::calculate_maximal_centers ( ) const
nodiscard

Returns the centers of all bins tied for the maximum frequency.

◆ calculate_maximum_frequency()

Index opennn::Histogram::calculate_maximum_frequency ( ) const
nodiscard

Returns the largest bin frequency.

◆ calculate_minimal_centers()

VectorR opennn::Histogram::calculate_minimal_centers ( ) const
nodiscard

Returns the centers of all bins tied for the minimum frequency.

◆ calculate_minimum_frequency()

Index opennn::Histogram::calculate_minimum_frequency ( ) const
nodiscard

Returns the smallest bin frequency.

◆ calculate_most_populated_bin()

Index opennn::Histogram::calculate_most_populated_bin ( ) const
nodiscard

Returns the index of the bin with the largest frequency.

◆ count_empty_bins()

Index opennn::Histogram::count_empty_bins ( ) const
nodiscard

Returns the number of bins with zero frequency.

◆ get_bins_number()

Index opennn::Histogram::get_bins_number ( ) const
nodiscard

Returns the number of bins in the histogram.

◆ save()

void opennn::Histogram::save ( const filesystem::path & ) const

Saves the histogram (centers and frequencies) to a text file.

Member Data Documentation

◆ centers

VectorR opennn::Histogram::centers

◆ frequencies

VectorR opennn::Histogram::frequencies

◆ maximums

VectorR opennn::Histogram::maximums

◆ minimums

VectorR opennn::Histogram::minimums