def _get_triplet_scores(self, triangles_list):
        """
        Returns the score of each of the triplets found in the current model

        Parameters
        ---------
        triangles_list: list
                        The list of variables forming the triangles to be updated. It is of the form of
                        [['var_5', 'var_8', 'var_7'], ['var_4', 'var_5', 'var_7']]

        Return: {frozenset({'var_8', 'var_5', 'var_7'}): 5.024, frozenset({'var_5', 'var_4', 'var_7'}): 10.23}
        """
        triplet_scores = {}
        for triplet in triangles_list:

            # Find the intersection sets of the current triplet
            triplet_intersections = [intersect for intersect in it.combinations(triplet, 2)]

            # Independent maximization
            ind_max = sum([np.amax(self.objective[frozenset(intersect)].values) for intersect in triplet_intersections])

            # Joint maximization
            joint_max = self.objective[frozenset(triplet_intersections[0])]
            for intersect in triplet_intersections[1:]:
                joint_max += self.objective[frozenset(intersect)]
            joint_max = np.amax(joint_max.values)
            # score = Independent maximization solution - Joint maximization solution
            score = ind_max - joint_max
            triplet_scores[frozenset(triplet)] = score

        return triplet_scores
def _get_triplet_scores ( self , triangles_list ) : triplet_scores = { } for triplet in triangles_list : triplet_intersections = [ intersect for intersect in it . combinations ( triplet , 2 ) ] ind_max = sum ( [ np . amax ( self . objective [ frozenset ( intersect ) ] . values ) for intersect in triplet_intersections ] ) joint_max = self . objective [ frozenset ( triplet_intersections [ 0 ] ) ] for intersect in triplet_intersections [ 1 : ] : joint_max += self . objective [ frozenset ( intersect ) ] joint_max = np . amax ( joint_max . values ) score = ind_max - joint_max triplet_scores [ frozenset ( triplet ) ] = score return triplet_scores
Returns the score of each of the triplets found in the current model

        Parameters
        ---------
        triangles_list: list
                        The list of variables forming the triangles to be updated. It is of the form of
                        [['var_5', 'var_8', 'var_7'], ['var_4', 'var_5', 'var_7']]

        Return: {frozenset({'var_8', 'var_5', 'var_7'}): 5.024, frozenset({'var_5', 'var_4', 'var_7'}): 10.23}