def evalcllr()

in mozetl/taar/taar_ensemble.py [0:0]


    def evalcllr(self, recommendations_list, unmasked_addons):
        # Organizer function to extract weights from recommendation list for passing to cllr.
        lrs_on_target_helper = np.array(
            [item[1] for item in recommendations_list if item[0] in unmasked_addons]
        )
        lrs_off_target_helper = np.array(
            [item[1] for item in recommendations_list if item[0] not in unmasked_addons]
        )
        try:
            tmp = self._cllr(lrs_on_target_helper, lrs_off_target_helper)
        except Exception:
            tmp = np.NaN

        if np.isnan(tmp):
            # This may happen if recommendations come back with a
            # weight of 0
            tmp = 0
        self._total += tmp
        return tmp