Skip to content

Commit bc5abfd

Browse files
committed
Fix some more numpy tests
1 parent 76b66f9 commit bc5abfd

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

data_structures/heap/binomial_heap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class BinomialHeap:
118118
values in merged heap; (merge is inplace)
119119
>>> results = []
120120
>>> while not first_heap.is_empty():
121-
... results.append(first_heap.delete_min())
121+
... results.append(int(first_heap.delete_min()))
122122
>>> results
123123
[17, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 34]
124124
"""

electronics/circular_convolution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def circular_convolution(self) -> list[float]:
3939
Usage:
4040
>>> convolution = CircularConvolution()
4141
>>> convolution.circular_convolution()
42-
[10.0 10.0, 6.0, 14.0]
42+
[10.0, 10.0, 6.0, 14.0]
4343
4444
>>> convolution.first_signal = [0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6]
4545
>>> convolution.second_signal = [0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5]

linear_programming/simplex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def generate_col_titles(self) -> list[str]:
108108
def find_pivot(self) -> tuple[Any, Any]:
109109
"""Finds the pivot row and column.
110110
>>> tuple(int(x) for x in Tableau(np.array([[-2,1,0,0,0], [3,1,1,0,6],
111-
... [1,2,0,1,7.]]), 2, 0).find_pivot()
111+
... [1,2,0,1,7.]]), 2, 0).find_pivot())
112112
(1, 0)
113113
"""
114114
objective = self.objectives[-1]

machine_learning/forecasting/run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def linear_regression_prediction(
2828
input : training data (date, total_user, total_event) in list of float
2929
output : list of total user prediction in float
3030
>>> n = linear_regression_prediction([2,3,4,5], [5,3,4,6], [3,1,2,4], [2,1], [2,2])
31-
>>> abs(n - 5.0) < 1e-6 # Checking precision because of floating point errors
31+
>>> bool(abs(n - 5.0) < 1e-6) # Checking precision because of floating point errors
3232
True
3333
"""
3434
x = np.array([[1, item, train_mtch[i]] for i, item in enumerate(train_dt)])
@@ -56,7 +56,7 @@ def sarimax_predictor(train_user: list, train_match: list, test_match: list) ->
5656
)
5757
model_fit = model.fit(disp=False, maxiter=600, method="nm")
5858
result = model_fit.predict(1, len(test_match), exog=[test_match])
59-
return result[0]
59+
return float(result[0])
6060

6161

6262
def support_vector_regressor(x_train: list, x_test: list, train_user: list) -> float:
@@ -75,7 +75,7 @@ def support_vector_regressor(x_train: list, x_test: list, train_user: list) -> f
7575
regressor = SVR(kernel="rbf", C=1, gamma=0.1, epsilon=0.1)
7676
regressor.fit(x_train, train_user)
7777
y_pred = regressor.predict(x_test)
78-
return y_pred[0]
78+
return float(y_pred[0])
7979

8080

8181
def interquartile_range_checker(train_user: list) -> float:
@@ -92,7 +92,7 @@ def interquartile_range_checker(train_user: list) -> float:
9292
q3 = np.percentile(train_user, 75)
9393
iqr = q3 - q1
9494
low_lim = q1 - (iqr * 0.1)
95-
return low_lim
95+
return float(low_lim)
9696

9797

9898
def data_safety_checker(list_vote: list, actual_result: float) -> bool:

0 commit comments

Comments
 (0)