fixed bugs in jensenshannon.h
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Divergence {
|
|||||||
|
|
||||||
template <typename Scalar> class JensenShannon {
|
template <typename Scalar> class JensenShannon {
|
||||||
|
|
||||||
|
public:
|
||||||
/** Calculate the Jensen Shannon Divergece from a set of sample densities
|
/** Calculate the Jensen Shannon Divergece from a set of sample densities
|
||||||
* Info: https://en.wikipedia.org/wiki/Jensen–Shannon_divergence
|
* Info: https://en.wikipedia.org/wiki/Jensen–Shannon_divergence
|
||||||
* @param P is the vector containing the densities of a set of samples
|
* @param P is the vector containing the densities of a set of samples
|
||||||
@@ -19,7 +20,7 @@ template <typename Scalar> class JensenShannon {
|
|||||||
static inline Scalar getGeneralFromSamples(Eigen::VectorXd P, Eigen::VectorXd Q, LOGMODE mode){
|
static inline Scalar getGeneralFromSamples(Eigen::VectorXd P, Eigen::VectorXd Q, LOGMODE mode){
|
||||||
Eigen::VectorXd M = 0.5 * (P + Q);
|
Eigen::VectorXd M = 0.5 * (P + Q);
|
||||||
|
|
||||||
return (0.5 * KullbackLeibler::getGeneralFromSamples(P, M, mode)) + (0.5 * KullbackLeibler::getGeneralFromSamples(Q, M, mode));
|
return (0.5 * KullbackLeibler<Scalar>::getGeneralFromSamples(P, M, mode)) + (0.5 * KullbackLeibler<Scalar>::getGeneralFromSamples(Q, M, mode));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user