def minrisk(self, Pdist: ProbabilityDistribution): min_risk = 128.0 for L in Labelling.iterAll(Pdist.getNumberOfLabels()): r = self.risk(L, Pdist) if (r < min_risk): min_risk = r min_risk_sol = L return (min_risk_sol, min_risk)
def maxrisk(self, Pdist: ProbabilityDistribution): max_risk = 0.0 for L in Labelling.iterAll(Pdist.getNumberOfLabels()): r = self.risk(L, Pdist) if (r > max_risk): max_risk = r max_risk_sol = L return (max_risk_sol, max_risk)