olpy/classifiers/iellip.py
def _update(self, x, y):
        """Updates the weight vector in case a mistake occured.
        
        When presented with a data point, this method evaluates
        the error and based on the result, updates or not the 
        weights vector.

        Args:
            x (:obj:`np.ndarray` or `list`): An array representing
                one single data point. Array needs to be 2D.
            y (`int`): Output value for the data point. Takes value
                between 1 and -1.

        Returns:
            None

        Raises:
            IndexError: if the value x is not 2D.
        """
        decision = self.weights.dot(x)
        prediction = np.sign(decision)
        v = (x @ self._sigma @ x.T)
        m = y * decision
        if prediction != y:
            if v != 0:
                # For a given class, we want alpha to be proportional to
                # the class weight.
                alpha = self.class_weight_[y] * (1 - m) / math.sqrt(v)
                g = y * x / math.sqrt(v)
                # Added an axis to avoid errors
                sigma = np.expand_dims(g @ self._sigma.T, axis=0)
                self.weights = self.weights + alpha * np.squeeze(sigma)
                self._sigma = ((self._sigma - self._c * sigma.T @ sigma) 
                                / (1 - self._c))
        self._c *= self._b
Updates the weight vector in case a mistake occured.
        
        When presented with a data point, this method evaluates
        the error and based on the result, updates or not the 
        weights vector.

        Args:
            x (:obj:`np.ndarray` or `list`): An array representing
                one single data point. Array needs to be 2D.
            y (`int`): Output value for the data point. Takes value
                between 1 and -1.

        Returns:
            None

        Raises:
            IndexError: if the value x is not 2D.
        
Updates the weight vector in case a mistake occured.
When presented with a data point, this method evaluates
the error and based on the result, updates or not the
weights vector.
Updates the weight vector in case a mistake occured . When presented with a data point this method evaluates the error and based on the result updates or not the weights vector .
def _update(self, x, y):
        decision = self.weights.dot(x)
        prediction = np.sign(decision)
        v = (x @ self._sigma @ x.T)
        m = y * decision
        if prediction != y:
            if v != 0:
                alpha = self.class_weight_[y] * (1 - m) / math.sqrt(v)
                g = y * x / math.sqrt(v)
                sigma = np.expand_dims(g @ self._sigma.T, axis=0)
                self.weights = self.weights + alpha * np.squeeze(sigma)
                self._sigma = ((self._sigma - self._c * sigma.T @ sigma) 
                                / (1 - self._c))
        self._c *= self._b
def _update ( self , x , y ) : decision = self . weights . dot ( x ) prediction = np . sign ( decision ) v = ( x @ self . _sigma @ x . T ) m = y * decision if prediction != y : if v != 0 : alpha = self . class_weight_ [ y ] * ( 1 - m ) / math . sqrt ( v ) g = y * x / math . sqrt ( v ) sigma = np . expand_dims ( g @ self . _sigma . T , axis = 0 ) self . weights = self . weights + alpha * np . squeeze ( sigma ) self . _sigma = ( ( self . _sigma - self . _c * sigma . T @ sigma ) / ( 1 - self . _c ) ) self . _c *= self . _b
Updates the weight vector in case a mistake occured.
Updates the weight vector in case a mistake occured .
"""Updates the weight vector in case a mistake occured.
        
        When presented with a data point, this method evaluates
        the error and based on the result, updates or not the 
        weights vector.

        Args:
            x (:obj:`np.ndarray` or `list`): An array representing
                one single data point. Array needs to be 2D.
            y (`int`): Output value for the data point. Takes value
                between 1 and -1.

        Returns:
            None

        Raises:
            IndexError: if the value x is not 2D.
        """ # For a given class, we want alpha to be proportional to # the class weight. # Added an axis to avoid errors
None
if the value x is not 2D.
if the value x is not 2D .
IndexError
self
x
y
Output value for the data point. Takes value
between 1 and -1.
Output value for the data point . Takes value between 1 and - 1 .
x (
`np.ndarray` or `list`): An array representing
one single data point. Array needs to be 2D.
` np . ndarray ` or ` list ` ) : An array representing one single data point . Array needs to be 2D .