夜空中最亮的星
2026-05-11
来自北京
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[25], line 3 # 测试 if __name__ == '__main__': ----> 3 main() Cell In[24], line 30, in main() # 结果可视化 print("正在生成可视化结果...") ---> 30 plot_results(test_scaled, test_labels, predictions) Cell In[23], line 8, in plot_results(test_data, test_labels, predictions, dim_indices) # 绘制正常数据 normal_mask = test_labels == 0 ----> 8 ax.plot(test_data[normal_mask, dim], label="正常数据", color="blue", alpha=0.6) # 绘制真实异常 true_anomaly_mask = test_labels == 1 IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed 运行报错 不知哪里的问题,使用附件代码运行也报这个错误
展开
夜空中最亮的星
2026-05-11
来自北京
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[25], line 3 1 # 测试 2 if __name__ == '__main__': ----> 3 main() Cell In[24], line 30, in main() 28 # 结果可视化 29 print("正在生成可视化结果...") ---> 30 plot_results(test_scaled, test_labels, predictions) Cell In[23], line 8, in plot_results(test_data, test_labels, predictions, dim_indices) 6 # 绘制正常数据 7 normal_mask = test_labels == 0 ----> 8 ax.plot(test_data[normal_mask, dim], label="正常数据", color="blue", alpha=0.6) 9 # 绘制真实异常 10 true_anomaly_mask = test_labels == 1 IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed 运行附件里的代码报错
展开