aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::learning::GreaterTupleOnLast Class Reference

#include <Miic.h>

Public Member Functions

bool operator() (const ProbabilisticRanking &e1, const ProbabilisticRanking &e2) const

Detailed Description

Definition at line 104 of file Miic.h.

Member Function Documentation

◆ operator()()

bool gum::learning::GreaterTupleOnLast::operator() ( const ProbabilisticRanking & e1,
const ProbabilisticRanking & e2 ) const

Definition at line 101 of file Miic.cpp.

102 {
103 double p1xz = std::get< 2 >(e1);
104 double p1yz = std::get< 3 >(e1);
105 double p2xz = std::get< 2 >(e2);
106 double p2yz = std::get< 3 >(e2);
107 double I1 = std::get< 1 >(e1);
108 double I2 = std::get< 1 >(e2);
109 // First, we look at the sign of information.
110 // Then, the probability values
111 // and finally the abs value of information.
112 if ((I1 < 0 && I2 < 0) || (I1 >= 0 && I2 >= 0)) {
113 if (std::max(p1xz, p1yz) == std::max(p2xz, p2yz)) {
114 return std::abs(I1) > std::abs(I2);
115 } else {
116 return std::max(p1xz, p1yz) > std::max(p2xz, p2yz);
117 }
118 } else {
119 return I1 < I2;
120 }
121 }

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