olpy/classifiers/arow.py
def _update(self, x: np.ndarray, y: int):
        """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.
        """
        f_t = self.weights.dot(x)
        v_t = x @ self._sigma @ x.T
        loss = max(0, 1 - f_t * y) * self.class_weight_[y]
        if loss > 0:
            beta_t = (1 / (v_t + self._r)) * self.class_weight_[y]
            alpha_t = loss * beta_t
            sigma = np.expand_dims(x @ self._sigma.T, axis=0)
            self.weights += alpha_t * y * np.squeeze(sigma)
            self._sigma -= beta_t * sigma.T @ sigma
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: np.ndarray, y: int):
        f_t = self.weights.dot(x)
        v_t = x @ self._sigma @ x.T
        loss = max(0, 1 - f_t * y) * self.class_weight_[y]
        if loss > 0:
            beta_t = (1 / (v_t + self._r)) * self.class_weight_[y]
            alpha_t = loss * beta_t
            sigma = np.expand_dims(x @ self._sigma.T, axis=0)
            self.weights += alpha_t * y * np.squeeze(sigma)
            self._sigma -= beta_t * sigma.T @ sigma
def _update ( self , x : np . ndarray , y : int ) : f_t = self . weights . dot ( x ) v_t = x @ self . _sigma @ x . T loss = max ( 0 , 1 - f_t * y ) * self . class_weight_ [ y ] if loss > 0 : beta_t = ( 1 / ( v_t + self . _r ) ) * self . class_weight_ [ y ] alpha_t = loss * beta_t sigma = np . expand_dims ( x @ self . _sigma . T , axis = 0 ) self . weights += alpha_t * y * np . squeeze ( sigma ) self . _sigma -= beta_t * sigma . T @ sigma
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.
        """
None
if the value x is not 2D.
if the value x is not 2D .
IndexError
self
x
np.ndarray
y
int
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 .