From e6084fa60955ffe11f8ad804addfc1638d266b07 Mon Sep 17 00:00:00 2001 From: Tarek Allam Date: Tue, 19 May 2020 13:57:32 +0100 Subject: [PATCH] Removing surplus brackets from print function The 2to3 script added extra brackets around print functions that were already compatible with Python 3. This has now been removed modified: code/Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py modified: code/Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py modified: code/Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py --- ...arning-Chapter_25_Preprocessing_and_Feature_Engineering.py | 2 +- ...nalytics_and_Machine_Learning-Chapter_28_Recommendation.py | 2 +- ...Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py b/code/Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py index 03b95ec..d0bdab8 100644 --- a/code/Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py +++ b/code/Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py @@ -252,7 +252,7 @@ result = model.transform(documentDF) for row in result.collect(): text, vector = row - print(("Text: [%s] => \nVector: %s\n" % (", ".join(text), str(vector)))) + print("Text: [%s] => \nVector: %s\n" % (", ".join(text), str(vector))) # COMMAND ---------- diff --git a/code/Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py b/code/Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py index 842320d..d455031 100644 --- a/code/Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py +++ b/code/Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py @@ -36,7 +36,7 @@ .setLabelCol("rating")\ .setPredictionCol("prediction") rmse = evaluator.evaluate(predictions) -print(("Root-mean-square error = %f" % rmse)) +print("Root-mean-square error = %f" % rmse) # COMMAND ---------- diff --git a/code/Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py b/code/Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py index 9d8abd6..b00f242 100644 --- a/code/Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py +++ b/code/Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py @@ -38,8 +38,8 @@ from pyspark.ml.evaluation import MulticlassClassificationEvaluator tested_df = p_model.transform(test_df) evaluator = MulticlassClassificationEvaluator(metricName="accuracy") -print(("Test set accuracy = " + str(evaluator.evaluate(tested_df.select( - "prediction", "label"))))) +print("Test set accuracy = " + str(evaluator.evaluate(tested_df.select( + "prediction", "label")))) # COMMAND ----------