Try to fix the AI some more

This commit is contained in:
2026-03-09 22:02:49 -07:00
parent a5ca197376
commit 234b9dcc70
3 changed files with 34 additions and 28 deletions
+13 -4
View File
@@ -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)