Improved readability (#1615)

* improved readability

* further readability improvements

* removed csv file and added f
This commit is contained in:
GeorgeChambi
2019-12-07 05:39:59 +00:00
committed by Christian Clauss
parent 938dd0bbb5
commit 9eb50cc223
21 changed files with 44 additions and 50 deletions

View File

@ -7,8 +7,8 @@ iris = load_iris()
iris.keys()
print("Target names: \n {} ".format(iris.target_names))
print("\n Features: \n {}".format(iris.feature_names))
print(f"Target names: \n {iris.target_names} ")
print(f"\n Features: \n {iris.feature_names}")
# Train set e Test set
X_train, X_test, y_train, y_test = train_test_split(

View File

@ -174,8 +174,8 @@ def accuracy(actual_y: list, predicted_y: list) -> float:
def main():
""" This function starts execution phase """
while True:
print(" Linear Discriminant Analysis ".center(100, "*"))
print("*" * 100, "\n")
print(" Linear Discriminant Analysis ".center(50, "*"))
print("*" * 50, "\n")
print("First of all we should specify the number of classes that")
print("we want to generate as training dataset")
# Trying to get number of classes
@ -239,7 +239,7 @@ def main():
else:
print(
f"Your entered value is {user_count}, Number of "
f"instances should be positive!"
"instances should be positive!"
)
continue
except ValueError:
@ -302,7 +302,7 @@ def main():
# for loop iterates over number of elements in 'probabilities' list and print
# out them in separated line
for i, probability in enumerate(probabilities, 1):
print("Probability of class_{} is: {}".format(i, probability))
print(f"Probability of class_{i} is: {probability}")
print("-" * 100)
# Calculating the values of variance for each class

View File

@ -446,7 +446,7 @@ def count_time(func):
start_time = time.time()
func(*args, **kwargs)
end_time = time.time()
print("smo algorithm cost {} seconds".format(end_time - start_time))
print(f"smo algorithm cost {end_time - start_time} seconds")
return call_func
@ -500,11 +500,9 @@ def test_cancel_data():
if test_tags[i] == predict[i]:
score += 1
print(
"\r\nall: {}\r\nright: {}\r\nfalse: {}".format(
test_num, score, test_num - score
)
f"\r\nall: {test_num}\r\nright: {score}\r\nfalse: {test_num - score}"
)
print("Rough Accuracy: {}".format(score / test_tags.shape[0]))
print(f"Rough Accuracy: {score / test_tags.shape[0]}")
def test_demonstration():