예제 #1
0
    def _prior_knowledge(self):
        """Create prior knowledge from arguments."""

        self.priors_from_cli()
        prior_indices, prior_labels = _merge_prior_knowledge(
            self.prior_included, self.prior_excluded)
        return np.array(prior_indices, dtype=np.int), np.array(prior_labels, dtype=np.int)
 def _prior_knowledge(self, logger):
     """Get the prior knowledge, either from specific paper IDs,
         and if they're not given from the number of in/exclusions."""
     if self.prior_included is not None or self.prior_excluded is not None:
         prior_indices, prior_labels = _merge_prior_knowledge(
             self.prior_included, self.prior_excluded)
     else:
         # Create the prior knowledge
         init_ind = sample_prior_knowledge(
             self.y,
             n_prior_included=self.n_prior_included,
             n_prior_excluded=self.n_prior_excluded,
             random_state=None  # TODO
         )
         prior_indices, prior_labels = init_ind, self.y[init_ind, ]
     self.classify(prior_indices, prior_labels, logger, method="initial")
    def _prior_knowledge(self):
        """ Get the prior knowledge, either from specific paper IDs,
            and if they're not given from the number of in/exclusions. """
        if self.prior_included or self.prior_excluded:
            prior_indices, prior_labels = _merge_prior_knowledge(
                self.prior_included, self.prior_excluded)

            return prior_indices, prior_labels
        # Create the prior knowledge
        init_ind = sample_prior_knowledge(
            self.y,
            n_prior_included=self.n_prior_included,
            n_prior_excluded=self.n_prior_excluded,
            random_state=None  # TODO
        )

        return init_ind, self.y[init_ind, ]
예제 #4
0
    def _prior_knowledge(self):
        if self.prior_included and self.prior_excluded:
            prior_indices, prior_labels = _merge_prior_knowledge(
                self.prior_included, self.prior_excluded)

            return prior_indices, prior_labels

        elif self.n_prior_included and self.n_prior_excluded:

            # Create the prior knowledge
            init_ind = sample_prior_knowledge(
                self.y,
                n_prior_included=self.n_prior_included,
                n_prior_excluded=self.n_prior_excluded,
                random_state=None  # TODO
            )

            return init_ind, self.y[init_ind, ]
        else:
            raise ValueError("provide both prior_included and prior_excluded, "
                             "or n_prior_included and n_prior_excluded")