mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-03 16:02:04 +00:00
Merge pull request #182 from DidierRLopes/fix-knn-regression
Fix knn regression
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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("")
|
||||
|
||||
Reference in New Issue
Block a user