mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Make some ruff fixes (#8154)
* Make some ruff fixes * Undo manual fix * Undo manual fix * Updates from ruff=0.0.251
This commit is contained in:
@ -129,7 +129,7 @@ class SmoSVM:
|
||||
# error
|
||||
self._unbound = [i for i in self._all_samples if self._is_unbound(i)]
|
||||
for s in self.unbound:
|
||||
if s == i1 or s == i2:
|
||||
if s in (i1, i2):
|
||||
continue
|
||||
self._error[s] += (
|
||||
y1 * (a1_new - a1) * k(i1, s)
|
||||
@ -225,7 +225,7 @@ class SmoSVM:
|
||||
def _choose_alphas(self):
|
||||
locis = yield from self._choose_a1()
|
||||
if not locis:
|
||||
return
|
||||
return None
|
||||
return locis
|
||||
|
||||
def _choose_a1(self):
|
||||
@ -423,9 +423,8 @@ class Kernel:
|
||||
return np.exp(-1 * (self.gamma * np.linalg.norm(v1 - v2) ** 2))
|
||||
|
||||
def _check(self):
|
||||
if self._kernel == self._rbf:
|
||||
if self.gamma < 0:
|
||||
raise ValueError("gamma value must greater than 0")
|
||||
if self._kernel == self._rbf and self.gamma < 0:
|
||||
raise ValueError("gamma value must greater than 0")
|
||||
|
||||
def _get_kernel(self, kernel_name):
|
||||
maps = {"linear": self._linear, "poly": self._polynomial, "rbf": self._rbf}
|
||||
|
Reference in New Issue
Block a user