olpy/classifiers/romma.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)
        if self._is_mistake(x, y):
            if LA.norm(self.weights) == 0:
                self.weights += y * x
            else:
                deno = ((LA.norm(x) * LA.norm(self.weights)) ** 2 
                        - f_t ** 2)
                if deno != 0:
                    coe_1 = (((LA.norm(x) * LA.norm(self.weights)) ** 2 
                                - y * f_t) / deno)
                    coe_2 = ((LA.norm(self.weights) ** 2 
                            * (y - f_t)) / deno)
                    self.weights = ((coe_1 * self.weights + coe_2 * x) 
                                    * self.class_weight_[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.
        
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)
        if self._is_mistake(x, y):
            if LA.norm(self.weights) == 0:
                self.weights += y * x
            else:
                deno = ((LA.norm(x) * LA.norm(self.weights)) ** 2 
                        - f_t ** 2)
                if deno != 0:
                    coe_1 = (((LA.norm(x) * LA.norm(self.weights)) ** 2 
                                - y * f_t) / deno)
                    coe_2 = ((LA.norm(self.weights) ** 2 
                            * (y - f_t)) / deno)
                    self.weights = ((coe_1 * self.weights + coe_2 * x) 
                                    * self.class_weight_[y])
def _update ( self , x : np . ndarray , y : int ) : f_t = self . weights . dot ( x ) if self . _is_mistake ( x , y ) : if LA . norm ( self . weights ) == 0 : self . weights += y * x else : deno = ( ( LA . norm ( x ) * LA . norm ( self . weights ) ) ** 2 - f_t ** 2 ) if deno != 0 : coe_1 = ( ( ( LA . norm ( x ) * LA . norm ( self . weights ) ) ** 2 - y * f_t ) / deno ) coe_2 = ( ( LA . norm ( self . weights ) ** 2 * ( y - f_t ) ) / deno ) self . weights = ( ( coe_1 * self . weights + coe_2 * x ) * self . class_weight_ [ y ] )
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 .