Код: Выделить всё
feature_idx = 0 # position ineterested this is X basically
forecast_step = 0 # first future step
y_true_plot = y_true_unscaled[:, feature_idx, forecast_step]
y_pred_plot = y_pred_unscaled[:, feature_idx, forecast_step]
import matplotlib.pyplot as plt
plt.figure(figsize=(12, 5))
plt.plot(y_true_plot, label="True", linewidth=2) # stays blue
plt.plot(y_pred_plot, label="Predicted", color="orange", linewidth=2, alpha =0.8) # solid orange line
plt.xlabel("Time window index")
plt.ylabel("Position X")
plt.title("Prediction vs Ground Truth (Position X)")
plt.legend()
plt.grid(True)
plt.show()

(Y, Z тоже точны, я просто не показываю картинки)
Я использую приведенный ниже код сейчас, чтобы построить график истинной истины против предсказанного XYZ, объединенного, чтобы получить 3D траектории:
Код: Выделить всё
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# choose forecast step
forecast_step = 0
# feature indices
x_idx, y_idx, z_idx = 0, 1, 2
# extract true trajectory
x_true = y_true_unscaled[:, x_idx, forecast_step]
y_true = y_true_unscaled[:, y_idx, forecast_step]
z_true = y_true_unscaled[:, z_idx, forecast_step]
# extract predicted trajectory
x_pred = y_pred_unscaled[:, x_idx, forecast_step]
y_pred = y_pred_unscaled[:, y_idx, forecast_step]
z_pred = y_pred_unscaled[:, z_idx, forecast_step]
# plot
fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(111, projection='3d')
ax.plot(x_true, y_true, z_true, label='Ground Truth', linewidth=2)
ax.plot(x_pred, y_pred, z_pred, label='Prediction', linestyle='-')
ax.set_xlabel('X position')
ax.set_ylabel('Y position')
ax.set_zlabel('Z position')
ax.set_title('3D Trajectory Prediction (forecast step = 0)')
ax.legend()
plt.show()

Вопрос в том, почему мои XYZ, когда я отображаю их на отдельных графиках, все они кажутся хорошими и точными с наземной истиной, близкой к предсказанию, но в 3D настолько запутался?
Подробнее здесь: https://stackoverflow.com/questions/798 ... y-z-points
Мобильная версия