return a prediction of label names
438763
def guess_labels(self, doc):
        
        if doc.nb_pages <= 0:
            return set()
        self.label_guesser.total_nb_documents = len(self._docs_by_id.keys())
        label_names = self.label_guesser.guess(doc)
        labels = set()
        for label_name in label_names:
            label = self.labels[label_name]
            labels.add(label)
        return labels
93539
def _get_labels(self, element, locations, mode):
        
        """
        # Parse inputs
        locations = self._parse_indices(locations)
        element = self._parse_element(element=element)
        # Collect list of all pore OR throat labels
        labels = self.keys(mode='labels', element=element)
        labels.sort()
        labels = sp.array(labels)  # Convert to ND-array for following checks
        # Make an 2D array with locations in rows and labels in cols
        arr = sp.vstack([self[item][locations] for item in labels]).T
        num_hits = sp.sum(arr, axis=0)  # Number of locations with each label
        if mode in ['or', 'union', 'any']:
            temp = labels[num_hits > 0]
        elif mode in ['and', 'intersection']:
            temp = labels[num_hits == locations.size]
        elif mode in ['xor', 'exclusive_or']:
            temp = labels[num_hits == 1]
        elif mode in ['nor', 'not', 'none']:
            temp = labels[num_hits == 0]
        elif mode in ['nand']:
            temp = labels[num_hits == (locations.size - 1)]
        elif mode in ['xnor', 'nxor']:
            temp = labels[num_hits > 1]
        else:
            raise Exception('Unrecognized mode:'+str(mode))
        return PrintableList(temp)
185366
def get_name_and_value(self, label_type):
        
        if label_type in self._label_values:
            return self._label_values[label_type]
        else:
            return (label_type, self._df_labels[label_type])
1201039
def get_labels(cs):
    """"""
    records = []
    for c in cs:
        records.extend(c.get('labels', []))
    return records
712687
def labels(self):
        """"""
        return tuple(_Label(label.get('id'), label.get('color'), label.text) for label
                     in self.root.iter('label'))
1044506
def labels(self, include_missing=False, include_transforms_for_dims=False):
        
        return [
            dim.labels(include_missing, include_transforms_for_dims)
            for dim in self.dimensions
        ]
1307829
def get_label(self, x, w):
        
        scores = np.dot(x,w)
        return np.argmax(scores,axis=1).transpose()
284065
def get_label_fields(self):
        
        present_label_fields = []
        for field in ann_label_fields:
            if getattr(self, field) is not None:
                present_label_fields.append(field)

        return present_label_fields
346322
def classifer_metrics(label, pred):
    
    prediction = np.argmax(pred, axis=1)
    label = label.astype(int)

    pred_is_entity = prediction != not_entity_index
    label_is_entity = label != not_entity_index

    corr_pred = (prediction == label) == (pred_is_entity == True)

    #how many entities are there?
    num_entities = np.sum(label_is_entity)
    entity_preds = np.sum(pred_is_entity)

    #how many times did we correctly predict an entity?
    correct_entitites = np.sum(corr_pred[pred_is_entity])

    #precision: when we predict entity, how often are we right?
    precision = correct_entitites/entity_preds
    if entity_preds == 0:
        precision = np.nan

    #recall: of the things that were an entity, how many did we catch?
    recall = correct_entitites / num_entities
    if num_entities == 0:
        recall = np.nan
    f1 = 2 * precision * recall / (precision + recall)
    return precision, recall, f1
353043
def _get_x_label(self, i):
        """"""
        if not self.x_labels or not self._y_labels or len(self._y_labels) <= i:
            return
        return self._y_labels[i][0]
871975
def get_labels(self, field):
        """"""
        return {c: self.cluster_meta.get(field, c)
                for c in self.clustering.cluster_ids}
1209038
def _label_desc(self, label, desc, label_color=''):
        '''  '''
        return self.BRIGHT +  label_color + label + self.RESET + desc
310803
def _keys_from_label(self, label):
        '''
        '''
        k1 = (label.content_id1, label.content_id2,
              label.annotator_id, time_complement(label.epoch_ticks))
        k2 = (label.content_id2, label.content_id1,
              label.annotator_id, time_complement(label.epoch_ticks))
        return k1, k2
862451
def label(self):
        """"""
        if not self.desc:
            return "%.3fs" % self.timestamp
        return "%s (%.3fs)" % (self.desc, self.timestamp)
674471
def extract_labels(filename):
    """"""
    with gzip.open(filename) as bytestream:
        magic = _read32(bytestream)
        if magic != 2049:
            raise ValueError(
                'Invalid magic number %d in MNIST label file: %s' %
                (magic, filename))
        num_items = _read32(bytestream)
        buf = bytestream.read(num_items)
        labels = numpy.frombuffer(buf, dtype=numpy.uint8)
        return labels
397091
def _decode_label(label):
    """"""
    if isinstance(label, list):
        return tuple(_decode_label(v) for v in label)
    return label
1096609
def _generate_feature_labels(self, X):
        '''
        
        '''
        Xt, Xc = get_ts_data_parts(X)

        ftr_sizes = self._check_features(self.features, Xt[0:3])
        f_labels = []

        # calculated features
        for key in ftr_sizes:
            for i in range(ftr_sizes[key]):
                f_labels += [key + '_' + str(i)]

        # contextual features
        if Xc is not None:
            Ns = len(np.atleast_1d(Xc[0]))
            s_labels = ["context_" + str(i) for i in range(Ns)]
            f_labels += s_labels

        return f_labels