From c4c34bf54f37a56399ddcb0b9a66a54b1ff23d01 Mon Sep 17 00:00:00 2001 From: didier Date: Mon, 15 Mar 2021 19:56:42 +0000 Subject: [PATCH 1/2] Fix KNN when not using backtesting --- gamestonk_terminal/prediction_techniques/knn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamestonk_terminal/prediction_techniques/knn.py b/gamestonk_terminal/prediction_techniques/knn.py index 584c6f73d80..ba44c3dc887 100644 --- a/gamestonk_terminal/prediction_techniques/knn.py +++ b/gamestonk_terminal/prediction_techniques/knn.py @@ -145,9 +145,9 @@ def k_nearest_neighbors(l_args, s_ticker, df_stock): # Plotting plt.figure() plt.plot(df_stock.index, df_stock["5. adjusted close"], lw=2) + s_knn = f"{ns_parser.n_neighbors}-Nearest Neighbors on {s_ticker}" # BACKTESTING if ns_parser.s_end_date: - s_knn = f"{ns_parser.n_neighbors}-Nearest Neighbors on {s_ticker}" plt.title(f"BACKTESTING: {s_knn} - {ns_parser.n_days} days prediction") else: plt.title(f"{s_knn} - {ns_parser.n_days} days prediction") From fdb5dafb0c55031e28cf78297706dcf68354c25e Mon Sep 17 00:00:00 2001 From: didier Date: Mon, 15 Mar 2021 19:56:56 +0000 Subject: [PATCH 2/2] Fix regression exiting without any arg --- gamestonk_terminal/prediction_techniques/regression.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gamestonk_terminal/prediction_techniques/regression.py b/gamestonk_terminal/prediction_techniques/regression.py index 947914ae496..c454feededb 100644 --- a/gamestonk_terminal/prediction_techniques/regression.py +++ b/gamestonk_terminal/prediction_techniques/regression.py @@ -343,6 +343,8 @@ def regression(l_args, s_ticker, df_stock, polynomial): print_pretty_prediction(df_pred, df_stock["5. adjusted close"].values[-1]) print("") + except SystemExit: + print("") except Exception as e: print(e) print("")