forpy  2
forpy::ShannonEntropy Class Reference

Computes the classical Shannon-Entropy. More...

#include <shannonentropy.h>

Inheritance diagram for forpy::ShannonEntropy:
forpy::IEntropyFunction

Public Member Functions

 ShannonEntropy ()
 
 ~ShannonEntropy ()
 
virtual float operator() (const float *class_members_numbers, const size_t &n, const float &fsum) const
 
bool operator== (const IEntropyFunction &rhs) const
 
- Public Member Functions inherited from forpy::IEntropyFunction
virtual ~IEntropyFunction ()
 
virtual float operator() (const std::vector< float > &class_members_numbers, const float &fsum) const
 The interface function that must be implemented. More...
 
virtual float operator() (const std::vector< float > &class_members_numbers) const
 Classical entropy calculation function. More...
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (ShannonEntropy)
 
template<class Archive >
void serialize (Archive &ar, const uint &)
 

Friends

class cereal::access
 
std::ostream & operator<< (std::ostream &stream, const ShannonEntropy &)
 

Additional Inherited Members

- Protected Member Functions inherited from forpy::IEntropyFunction
 IEntropyFunction ()
 

Detailed Description

Computes the classical Shannon-Entropy.

Works correctly up to a total sum of elements of numeric_limits<float>::max().

For classes \(C={c_1, \ldots, c_n}\), the Shannon entropy is defined as

\[-\sum_{c\in C}p_z\cdot \log_2 p_z.\]

The differential Shannon entropy for a normal distribution with covariance matrix \(\Sigma\) in \(n\) dimensions is defined as

\[\frac{1}{2}\log\left((2\pi e)^n\left|\Sigma\right|\right).\]

Definition at line 34 of file shannonentropy.h.

Constructor & Destructor Documentation

◆ ShannonEntropy()

forpy::ShannonEntropy::ShannonEntropy ( )

◆ ~ShannonEntropy()

forpy::ShannonEntropy::~ShannonEntropy ( )

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

forpy::ShannonEntropy::DISALLOW_COPY_AND_ASSIGN ( ShannonEntropy  )
private

◆ operator()()

virtual float forpy::ShannonEntropy::operator() ( const float *  class_members_numbers,
const size_t &  n,
const float &  fsum 
) const
inlinevirtual

Reimplemented from forpy::IEntropyFunction.

Definition at line 39 of file shannonentropy.h.

◆ operator==()

bool forpy::ShannonEntropy::operator== ( const IEntropyFunction rhs) const
virtual

Deep equality comparison.

Reimplemented from forpy::IEntropyFunction.

◆ serialize()

template<class Archive >
void forpy::ShannonEntropy::serialize ( Archive &  ar,
const uint  
)
inlineprivate

Definition at line 74 of file shannonentropy.h.

Friends And Related Function Documentation

◆ cereal::access

friend class cereal::access
friend

Definition at line 72 of file shannonentropy.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const ShannonEntropy  
)
friend

Definition at line 62 of file shannonentropy.h.


The documentation for this class was generated from the following file: