#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`nor`
==================

.. module:: nor
    :platform: Unix, Windows
    :synopsis:

.. moduleauthor:: hbldh <<EMAIL>>

Created on 2015-11-05

"""

from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import

import numpy as np

from skboost.milboost.softmax import SoftmaxFunction


class NoisyOR(SoftmaxFunction):
    """The Noisy OR softmax function."""

    def __init__(self, *args):
        super(NoisyOR, self).__init__(*args)

    def f(self, x):
        """

        :param x: The values to evaluate softmax over.
        :type x: :py:class:`numpy.ndarray`
        :return: The NOR softmax value.
        :rtype: float

        """
        return 1 - np.prod(1 - x)

    def d_dt(self, x):
        return (1 - self.f(x)) / (1 - x)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`nor`
==================

.. module:: nor
    :platform: Unix, Windows
    :synopsis:

.. moduleauthor:: hbldh <<EMAIL>>

Created on 2015-11-05

"""

from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import

import numpy as np

from skboost.milboost.softmax import SoftmaxFunction


class NoisyOR(SoftmaxFunction):
    """The Noisy OR softmax function."""

    def __init__(self, *args):
        super(NoisyOR, self).__init__(*args)

    def f(self, x):
        """

        :param x: The values to evaluate softmax over.
        :type x: :py:class:`numpy.ndarray`
        :return: The NOR softmax value.
        :rtype: float

        """
        return 1 - np.prod(1 - x)

    def d_dt(self, x):
        return (1 - self.f(x)) / (1 - x)

#!/usr/bin/env python # -*- coding: utf-8 -*- :mod:`nor` ==================  .. module:: nor     :platform: Unix, Windows     :synopsis:  .. moduleauthor:: hbldh <<EMAIL>>  Created on 2015-11-05 The Noisy OR softmax function. :param x: The values to evaluate softmax over.         :type x: :py:class:`numpy.ndarray`         :return: The NOR softmax value.         :rtype: float