olpy/classifiers/sop.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.
        """
        x_ = np.expand_dims(x, axis=0)
        s_t = x_ @ self._sigma.T
        v_t = x @ s_t.T
        beta_t = 1/(v_t + 1)
        sigma_t = self._sigma - beta_t * (s_t.T @ s_t)
        f_t = self.weights @ sigma_t @ x_.T

        if np.sign(f_t) != y:
            self.weights = self.weights + y * x * self.class_weight_[y]
        self._sigma = sigma_t
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):
        x_ = np.expand_dims(x, axis=0)
        s_t = x_ @ self._sigma.T
        v_t = x @ s_t.T
        beta_t = 1/(v_t + 1)
        sigma_t = self._sigma - beta_t * (s_t.T @ s_t)
        f_t = self.weights @ sigma_t @ x_.T
        if np.sign(f_t) != y:
            self.weights = self.weights + y * x * self.class_weight_[y]
        self._sigma = sigma_t
def _update ( self , x : np . ndarray , y : int ) : x_ = np . expand_dims ( x , axis = 0 ) s_t = x_ @ self . _sigma . T v_t = x @ s_t . T beta_t = 1 / ( v_t + 1 ) sigma_t = self . _sigma - beta_t * ( s_t . T @ s_t ) f_t = self . weights @ sigma_t @ x_ . T if np . sign ( f_t ) != y : self . weights = self . weights + y * x * self . class_weight_ [ y ] self . _sigma = sigma_t
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 .