numpy.logical_not - python examples

Here are the examples of the python api numpy.logical_not taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

145 Examples 7

3 View Complete Implementation : _converter.py
Copyright MIT License
Author : alvarob96
    def _set_default_format(self, vmin, vmax):
        "Returns the default ticks spacing."

        if self.plot_obj.date_axis_info is None:
            self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
        info = self.plot_obj.date_axis_info

        if self.isminor:
            format = np.compress(info['min'] & np.logical_not(info['maj']),
                                 info)
        else:
            format = np.compress(info['maj'], info)
        self.formatdict = {x: f for (x, _, _, f) in format}
        return self.formatdict

3 View Complete Implementation : base.py
Copyright MIT License
Author : alvarob96
    def drop_duplicates(self, keep='first', inplace=False):
        inplace = validate_bool_kwarg(inplace, 'inplace')
        if isinstance(self, ABCIndexClast):
            if self.is_unique:
                return self._shallow_copy()

        duplicated = self.duplicated(keep=keep)
        result = self[np.logical_not(duplicated)]
        if inplace:
            return self._update_inplace(result)
        else:
            return result

3 View Complete Implementation : util.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : WinVector
def summarize_column(x, *, fn=numpy.mean):
    """
    Summarize column to a non-missing scalar.

    :param x: a vector/Series or column of numbers
    :param fn: summarize function (such as numpy.mean), only pasted non-bad positions
    :return: scalar float summary of the non-None positions of x (otherwise 0)
    """

    x = safe_to_numeric_array(x)
    not_bad = numpy.logical_not(is_bad(x))
    n_not_bad = sum(not_bad)
    if n_not_bad < 1:
        return 0.0
    x = x[not_bad]
    v = 0.0 + fn(x)
    if pandas.isnull(v) or math.isnan(v) or math.isinf(v):
        return 0.0
    return v

3 View Complete Implementation : util.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : WinVector
def summarize_column(x, *, fn=numpy.mean):
    """
    Summarize column to a non-missing scalar.

    :param x: a vector/Series or column of numbers
    :param fn: summarize function (such as numpy.mean), only pasted non-bad positions
    :return: scalar float summary of the non-None positions of x (otherwise 0)
    """

    x = safe_to_numeric_array(x)
    not_bad = numpy.logical_not(is_bad(x))
    n_not_bad = sum(not_bad)
    if n_not_bad < 1:
        return 0.0
    x = x[not_bad]
    v = 0.0 + fn(x)
    if pandas.isnull(v) or math.isnan(v) or math.isinf(v):
        return 0.0
    return v

3 View Complete Implementation : ogive.py
Copyright Apache License 2.0
Author : Knewton
    @staticmethod
    def bernoulli_logli(trues, probs, average=False):
        """ Compute the log-likelihood of all the data, given the Bernoulli probabilities.
        :param np.ndarray trues: array of boolean data values
        :param np.ndarray probs: array of probability of true
        :param bool average: whether to return the average log-likelihood, rather than the sum
        :return: the log-likelihood
        :rtype: float
        """
        if trues.shape != probs.shape:
            raise ValueError("trues and probs have shapes {} and {}, must be numpy arrays of same "
                             "shape".format(trues.shape, probs.shape))
        falses = np.logical_not(trues)
        log_li = np.sum(np.log(probs[trues])) + np.sum(np.log(1.0 - probs[falses]))
        if average:
            return log_li / trues.size
        else:
            return log_li

3 View Complete Implementation : metrics.py
Copyright Apache License 2.0
Author : Knewton
    @staticmethod
    def d_prime_helper(data, prob_true):
        """ Compute the d-prime metric (of the separation of probabilities astociated with positive
        data labels and negative data labels).

        :param np.ndarray[bool] data: binary data values (positive/negative clast labels).
        :param np.ndarray[float] prob_true: probability of positive label
        :return: d-prime metric
        :rtype: float
        """
        if len(prob_true) != len(data):
            raise ValueError('prob_true and data must have the same length')
        prob_true, data = Metrics._check_finite(prob_true, data)
        pc_correct = prob_true[data]
        pc_incorrect = prob_true[np.logical_not(data)]
        mean_sep = np.mean(pc_correct) - np.mean(pc_incorrect)
        norm_const = np.sqrt(0.5 * (np.var(pc_correct) + np.var(pc_incorrect)))
        return mean_sep / norm_const

3 View Complete Implementation : _converter.py
Copyright MIT License
Author : jgagneastro
    def _set_default_format(self, vmin, vmax):
        "Returns the default ticks spacing."

        if self.plot_obj.date_axis_info is None:
            self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
        info = self.plot_obj.date_axis_info

        if self.isminor:
            format = np.compress(info['min'] & np.logical_not(info['maj']),
                                 info)
        else:
            format = np.compress(info['maj'], info)
        self.formatdict = {x: f for (x, _, _, f) in format}
        return self.formatdict

3 View Complete Implementation : _converter.py
Copyright Apache License 2.0
Author : Frank-qlu
    def _set_default_format(self, vmin, vmax):
        "Returns the default ticks spacing."

        if self.plot_obj.date_axis_info is None:
            self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
        info = self.plot_obj.date_axis_info

        if self.isminor:
            format = np.compress(info['min'] & np.logical_not(info['maj']),
                                 info)
        else:
            format = np.compress(info['maj'], info)
        self.formatdict = {x: f for (x, _, _, f) in format}
        return self.formatdict

3 View Complete Implementation : _converter.py
Copyright Apache License 2.0
Author : Frank-qlu
    def _set_default_format(self, vmin, vmax):
        "Returns the default ticks spacing."

        if self.plot_obj.date_axis_info is None:
            self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
        info = self.plot_obj.date_axis_info

        if self.isminor:
            format = np.compress(info['min'] & np.logical_not(info['maj']),
                                 info)
        else:
            format = np.compress(info['maj'], info)
        self.formatdict = {x: f for (x, _, _, f) in format}
        return self.formatdict

3 View Complete Implementation : transformed_distribution.py
Copyright MIT License
Author : PacktPublishing
def _logical_not(x):
  """Convenience function which attempts to statically apply `logical_not`."""
  x_ = _static_value(x)
  if x_ is None:
    return math_ops.logical_not(x)
  return constant_op.constant(np.logical_not(x_))