Skip to content

Commit 637fb0e

Browse files
committed
fixed error on stock prediction tutorial
1 parent 0ae66ac commit 637fb0e

File tree

1 file changed

+1
-1
lines changed
  • machine-learning/stock-prediction

1 file changed

+1
-1
lines changed

machine-learning/stock-prediction/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def predict(model, data, classification=False):
5858
# evaluate the model
5959
mse, mae = model.evaluate(data["X_test"], data["y_test"], verbose=0)
6060
# calculate the mean absolute error (inverse scaling)
61-
mean_absolute_error = data["column_scaler"]["adjclose"].inverse_transform(mae.reshape(1, -1))[0][0]
61+
mean_absolute_error = data["column_scaler"]["adjclose"].inverse_transform([[mae]])[0][0]
6262
print("Mean Absolute Error:", mean_absolute_error)
6363
# predict the future price
6464
future_price = predict(model, data)

0 commit comments

Comments
 (0)