Calculations that only depend on aggregate counts in Confusion Matrix go here

def refresh_meta(self):
        """Calculations that only depend on aggregate counts in Confusion Matrix go here"""

        # these calcs are duplicated in __init__()
        setattr(self, '_num_classes', len(self.index))
        setattr(self, '_colnums', np.arange(0, self._num_classes))
        try:
            setattr(self, '_neg_label',
                    next(label for label in self.columns if str(label).strip().lower()[0] in ('-nh0')))
        except StopIteration:
            setattr(self, '_neg_label', self.columns[-1])
        try:
            setattr(self, '_pos_label', next(label for label in self.columns if label != self._neg_label))
        except StopIteration:
            setattr(self, '_pos_label', infer_pos_label(self._neg_label))

        # TODO: reorder columns with newly guessed pos and neg class labels first

        # TODO: gather up additional meta calculations here so
        #       a Confusion matrix can be build from an existing DataFrame that contains confusion counts
        #       rather than just two columns of labels.
        self.__setattr__('_hist_labels', self.sum().astype(int))
        self.__setattr__('_num_total', self._hist_labels.sum())
        assert(self._num_total == self.sum().sum())
        setattr(self, '_num_pos_labels', self._hist_labels.get(self._pos_label, 0))
        # everything that isn't positive is negative
        setattr(self, '_num_neg_labels', self._num_total - self._num_pos_labels)
        setattr(self, '_hist_classes', self.T.sum())
        setattr(self, '_num_pos', self._hist_classes.get(self._pos_label, 0))
        setattr(self, '_num_neg', self._hist_classes.sum() - self._num_pos)  # everything that isn't positive is negative
        setattr(self, '_tp', self.get(self._pos_label, pd.Series()).get(self._pos_label, 0))
        setattr(self, '_tpr', safe_div(float(self._tp), self._num_pos))
        setattr(self, '_tn', np.diag(self).sum() - self._tp)
        setattr(self, '_tnr', safe_div(float(self._tn), self._num_neg))
        setattr(self, '_fp', self.get(self._pos_label, pd.Series()).sum() - self._tp)
        setattr(self, '_fpr', safe_div(float(self._fp), self._num_neg))
        setattr(self, '_fn', self._num_neg_labels - self._tn)
        setattr(self, '_fnr', safe_div(float(self._fn), self._num_pos))
        setattr(self, '_plr', safe_div(float(self._tpr), self._fpr))
        setattr(self, '_nlr', safe_div(float(self._fnr), self._tnr))
        setattr(self, '_binary_accuracy', safe_div(self._tp + self._tn, self._num_samples))
        setattr(self, '_binary_sensitivity', safe_div(self._tp, self._tp + self._fn))
        setattr(self, '_binary_specificity', safe_div(self._tn, self._tn + self._fp))