Skip to content

Commit cc27828

Browse files
committed
Change the type of the degree
1 parent 755b27f commit cc27828

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

machine_learning/support_vector_machines.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class SVC:
5757
>>> SVC(kernel="polynomial",degree=None)
5858
Traceback (most recent call last):
5959
...
60-
ValueError: degree must be int
60+
ValueError: degree must be float or int
6161
>>> SVC(kernel="polynomial",degree=-1)
6262
Traceback (most recent call last):
6363
...
@@ -70,7 +70,7 @@ def __init__(
7070
regularization: float = np.inf,
7171
kernel: str = "linear",
7272
gamma: float = 0.0,
73-
degree: int =0.0,
73+
degree: float =0.0,
7474
coef0: float = 0.0,
7575
) -> None:
7676
self.regularization = regularization
@@ -93,8 +93,8 @@ def __init__(
9393
elif kernel == "polynomial":
9494
if self.degree == 0:
9595
raise ValueError("polynomial kernel requires degree")
96-
if not isinstance(self.degree, int) :
97-
raise ValueError("degree must be int")
96+
if not isinstance(self.degree, (float, int)) :
97+
raise ValueError("degree must be float or int")
9898
if not self.degree > 0:
9999
raise ValueError("degree must be > 0")
100100
self.kernel = self.__polynomial

0 commit comments

Comments
 (0)