forpy
2
|
Computes the classical Shannon-Entropy. More...
#include <shannonentropy.h>
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 |
![]() | |
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 | |
![]() | |
IEntropyFunction () | |
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.
forpy::ShannonEntropy::ShannonEntropy | ( | ) |
forpy::ShannonEntropy::~ShannonEntropy | ( | ) |
|
private |
|
inlinevirtual |
Reimplemented from forpy::IEntropyFunction.
Definition at line 39 of file shannonentropy.h.
|
virtual |
Deep equality comparison.
Reimplemented from forpy::IEntropyFunction.
|
inlineprivate |
Definition at line 74 of file shannonentropy.h.
|
friend |
Definition at line 72 of file shannonentropy.h.
|
friend |
Definition at line 62 of file shannonentropy.h.