(self, examples)
Retrieve by examples.

        Parameters
        ----------
        examples: array-like or object
            The examples used for retrieving. Should be a subset in the repository.

        Returns
        -------
        y: array-like
            The retrieved labels.
Retrieve by examples.
Retrieve by examples .
def retrieve_by_examples(self, examples):
        """Retrieve by examples.

        Parameters
        ----------
        examples: array-like or object
            The examples used for retrieving. Should be a subset in the repository.

        Returns
        -------
        y: array-like
            The retrieved labels.
        """
        if not self._instance_flag:
            raise Exception("This data base is not initialized with _examples, retrieve by example is illegal.")
        examples = np.asarray(examples)
        if examples.ndim == 1:
            ind = self._find_one_example(examples)
            if ind == -1:
                warnings.warn("Example %s for retrieving is not in the repository, skip." % str(examples),
                              category=ValidityWarning)
                return None, None
            return self._X[ind,], self._y[ind,]
        elif examples.ndim == 2:
            ind = []
            for i, exa in enumerate(examples):
                one_example_ind = self._find_one_example(exa)
                if one_example_ind == -1:
                    warnings.warn("Example %s for retrieving is not in the repository, skip." % str(exa),
                                  category=ValidityWarning)
                else:
                    ind.append(one_example_ind)
            return self._X[ind, ], self._y[ind, ]
        else:
            raise Exception("A 1D or 2D array is expected. But received: %d" % examples.ndim)
def retrieve_by_examples ( self , examples ) : if not self . _instance_flag : raise Exception ( "This data base is not initialized with _examples, retrieve by example is illegal." ) examples = np . asarray ( examples ) if examples . ndim == 1 : ind = self . _find_one_example ( examples ) if ind == - 1 : warnings . warn ( "Example %s for retrieving is not in the repository, skip." % str ( examples ) , category = ValidityWarning ) return None , None return self . _X [ ind , ] , self . _y [ ind , ] elif examples . ndim == 2 : ind = [ ] for i , exa in enumerate ( examples ) : one_example_ind = self . _find_one_example ( exa ) if one_example_ind == - 1 : warnings . warn ( "Example %s for retrieving is not in the repository, skip." % str ( exa ) , category = ValidityWarning ) else : ind . append ( one_example_ind ) return self . _X [ ind , ] , self . _y [ ind , ] else : raise Exception ( "A 1D or 2D array is expected. But received: %d" % examples . ndim )