Пример #1
0
    def __init__(self,
                 allow_identical_outcomes=False,
                 outcome_warning_threshold=0.99,
                 n_outcomes_cutoff=None):
        super(FiniteOutcomeModel, self).__init__(
            outcome_warning_threshold=outcome_warning_threshold,
            allow_identical_outcomes=allow_identical_outcomes)
        self._n_outcomes_cutoff = n_outcomes_cutoff

        if self.is_n_outcomes_constant:
            # predefine if we can
            self._domain = IntegerDomain(min=0, max=self.n_outcomes(None) - 1)
Пример #2
0
    def domain(self, expparams):
        """
        Returns a list of ``Domain``s, one for each input expparam.

        :param numpy.ndarray expparams:  Array of experimental parameters. This
            array must be of dtype agreeing with the ``expparams_dtype``
            property, or, in the case where ``n_outcomes_constant`` is ``True``,
            ``None`` should be a valid input.

        :rtype: list of ``Domain``
        """
        return [
            IntegerDomain(min=0, max=n_o - 1)
            for n_o in self.n_outcomes(expparams)
        ]
Пример #3
0
    def domain(self, expparams):
        """
        Returns a list of :class:`Domain` objects, one for each input expparam.

        :param numpy.ndarray expparams:  Array of experimental parameters. This
            array must be of dtype agreeing with the ``expparams_dtype``
            property, or, in the case where ``n_outcomes_constant`` is ``True``,
            ``None`` should be a valid input.

        :rtype: list of ``Domain``
        """
        # As a convenience to most users, we define domain for them. If a
        # fancier domain is desired, this method can easily be overridden.
        if self.is_n_outcomes_constant:
            return self._domain if expparams is None else [
                self._domain for ep in expparams
            ]
        else:
            return [
                IntegerDomain(min=0, max=n_o - 1)
                for n_o in self.n_outcomes(expparams)
            ]