(self, labels, indexes, examples=None)
initialize supervised information.
initialize supervised information.
initialize supervised information .
def __init__(self, labels, indexes, examples=None):
        """initialize supervised information.
        """
        # check and record parameters
        assert isinstance(labels, (list, np.ndarray))
        assert isinstance(indexes, (list, np.ndarray, IndexCollection, MultiLabelIndexCollection))
        if not check_one_to_one_correspondence(labels, indexes, examples):
            raise ValueError("Different length of given indexes and labels found.")

        # self._y = copy.copy(_labels)
        self._index_len = len(labels)
        self._indexes = list(indexes)
        self._instance_flag = False if examples is None else True

        # several indexes construct
        if self._instance_flag:
            examples = [tuple(vec) for vec in examples]
            self._exa2ind = dict(zip(examples, self._indexes))
            self._ind2exa = dict(zip(self._indexes, examples))
        self._ind2label = dict(zip(self._indexes, labels))

        # record
        self.cost_inall = 0
        self._cost_arr = []
        self.num_of_queries = 0
        self._query_history = []
def __init__ ( self , labels , indexes , examples = None ) : # check and record parameters assert isinstance ( labels , ( list , np . ndarray ) ) assert isinstance ( indexes , ( list , np . ndarray , IndexCollection , MultiLabelIndexCollection ) ) if not check_one_to_one_correspondence ( labels , indexes , examples ) : raise ValueError ( "Different length of given indexes and labels found." ) # self._y = copy.copy(_labels) self . _index_len = len ( labels ) self . _indexes = list ( indexes ) self . _instance_flag = False if examples is None else True # several indexes construct if self . _instance_flag : examples = [ tuple ( vec ) for vec in examples ] self . _exa2ind = dict ( zip ( examples , self . _indexes ) ) self . _ind2exa = dict ( zip ( self . _indexes , examples ) ) self . _ind2label = dict ( zip ( self . _indexes , labels ) ) # record self . cost_inall = 0 self . _cost_arr = [ ] self . num_of_queries = 0 self . _query_history = [ ]