olpy/classifiers/alma.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.
        """
        gamma_k = self._B * math.sqrt(self._p - 1) / math.sqrt(self._k)
        if y * self.weights.dot(x) <= (1 - self._alpha) * gamma_k:
            eta_k = ((self._C / (math.sqrt(self._p - 1) * math.sqrt(self._k)))
                     * self.class_weight_[y])
            self.weights = self.weights + eta_k * y * x
            norm_w = LA.norm(self.weights, ord=self._p)
            self.weights = self.weights / (max(1, norm_w))
            self._k += 1
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):
        gamma_k = self._B * math.sqrt(self._p - 1) / math.sqrt(self._k)
        if y * self.weights.dot(x) <= (1 - self._alpha) * gamma_k:
            eta_k = ((self._C / (math.sqrt(self._p - 1) * math.sqrt(self._k)))
                     * self.class_weight_[y])
            self.weights = self.weights + eta_k * y * x
            norm_w = LA.norm(self.weights, ord=self._p)
            self.weights = self.weights / (max(1, norm_w))
            self._k += 1
def _update ( self , x : np . ndarray , y : int ) : gamma_k = self . _B * math . sqrt ( self . _p - 1 ) / math . sqrt ( self . _k ) if y * self . weights . dot ( x ) <= ( 1 - self . _alpha ) * gamma_k : eta_k = ( ( self . _C / ( math . sqrt ( self . _p - 1 ) * math . sqrt ( self . _k ) ) ) * self . class_weight_ [ y ] ) self . weights = self . weights + eta_k * y * x norm_w = LA . norm ( self . weights , ord = self . _p ) self . weights = self . weights / ( max ( 1 , norm_w ) ) self . _k += 1
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 .