Skip to content

Commit b9bff8f

Browse files
authored
Remove \r from strings (TheAlgorithms#1622)
* Remove \r from strings * Satisfy tensorflow with numpy>=1.17.4
1 parent 1cbeaa2 commit b9bff8f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

machine_learning/sequential_minimum_optimization.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def fit(self):
8585
i1, i2 = self.choose_alpha.send(state)
8686
state = None
8787
except StopIteration:
88-
print("Optimization done!\r\nEvery sample satisfy the KKT condition!")
88+
print("Optimization done!\nEvery sample satisfy the KKT condition!")
8989
break
9090

9191
# 2: calculate new alpha2 and new alpha1
@@ -453,7 +453,7 @@ def call_func(*args, **kwargs):
453453

454454
@count_time
455455
def test_cancel_data():
456-
print("Hello!\r\nStart test svm by smo algorithm!")
456+
print("Hello!\nStart test svm by smo algorithm!")
457457
# 0: download dataset and load into pandas' dataframe
458458
if not os.path.exists(r"cancel_data.csv"):
459459
request = urllib.request.Request(
@@ -499,13 +499,13 @@ def test_cancel_data():
499499
for i in range(test_tags.shape[0]):
500500
if test_tags[i] == predict[i]:
501501
score += 1
502-
print(f"\r\nall: {test_num}\r\nright: {score}\r\nfalse: {test_num - score}")
502+
print(f"\nall: {test_num}\nright: {score}\nfalse: {test_num - score}")
503503
print(f"Rough Accuracy: {score / test_tags.shape[0]}")
504504

505505

506506
def test_demonstration():
507507
# change stdout
508-
print("\r\nStart plot,please wait!!!")
508+
print("\nStart plot,please wait!!!")
509509
sys.stdout = open(os.devnull, "w")
510510

511511
ax1 = plt.subplot2grid((2, 2), (0, 0))

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fake_useragent
44
flake8
55
matplotlib
66
mypy
7-
numpy
7+
numpy>=1.17.4
88
opencv-python
99
pandas
1010
pillow

0 commit comments

Comments
 (0)