Try to fix the AI some more
This commit is contained in:
@@ -49,20 +49,29 @@ def Predict():
|
||||
scaled_predictions = reconstructed_model.predict(scaled_data)
|
||||
|
||||
# Use the loaded target scaler to get back to % change
|
||||
actual_prediction = target_scaler.inverse_transform(scaled_predictions)
|
||||
actual_prediction = target_scaler.inverse_transform(scaled_predictions.reshape(-1, 1)).flatten()
|
||||
|
||||
# 'predictions' will be a 2D array, flatten it if you want a simple list
|
||||
flat_predictions = actual_prediction.flatten().tolist()
|
||||
flat_predictions = actual_prediction
|
||||
|
||||
# Get the overall trend to pull predictions from
|
||||
predictionTrend = 0
|
||||
with open("Target_Close_Average.txt", "r") as f:
|
||||
predictionTrend = float(f.read().strip())
|
||||
|
||||
# Set the movement indicator
|
||||
movement_indicator = 0
|
||||
if (np.mean(flat_predictions) > 0.01):
|
||||
averagePrediction = np.mean(flat_predictions)
|
||||
if (averagePrediction > 0.005): # as in 3% swing up
|
||||
movement_indicator = 1
|
||||
elif (np.mean(flat_predictions) < -0.01):
|
||||
elif (averagePrediction < -0.005): # as in 3% swing down
|
||||
movement_indicator = -1
|
||||
else:
|
||||
movement_indicator = 0
|
||||
|
||||
# Debug data
|
||||
print(f"averagePrediction: {averagePrediction}")
|
||||
|
||||
# Return to C# via stdout
|
||||
print(f"---RESULT_START---")
|
||||
print(movement_indicator)
|
||||
|
||||
Reference in New Issue
Block a user