Ошибка значения: несоответствие формы: объекты не могут быть переданы в одну форму-python

#python

Вопрос:

Я пытаюсь нарисовать 3D-точечную диаграмму с помощью Axes3D. Однако есть ошибка «Ошибка значения: несоответствие формы: объекты не могут быть переданы в одну форму» Вот мой код

 forest = RandomForestRegressor() x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2) forest.fit(x_train, y_train)  forest_rand_grid = {'n_estimators': list((100, 200, 300)), 'max_depth': list((3, 6, 9))} grid = GridSearchCV(RandomForestRegressor(), param_grid=forest_rand_grid, cv=5) grid.fit(x_train, y_train) estimators = np.array(grid.param_grid['n_estimators']) depth = np.array(grid.param_grid['max_depth']) results = np.array(grid.cv_results_['mean_test_score'])  ax = plt.axes(projection='3d') ax.set_title('Grid Search Best Results') ax.scatter(estimators, depth, results)  ax.set_xlabel('n_estimators') ax.set_ylabel('max_depth') ax.set_zlabel('Results')  plt.show()  

Вот сообщение об ошибке

 File "D:PythonProjectRandomForest.py", line 27, in RandomForestSelf  ax.scatter(estimators, results, depth)  File "C:ProgramDataAnaconda3envspythonProjectlibsite-packagesmpl_toolkitsmplot3daxes3d.py", line 2406, in scatter  xs, ys, zs = np.broadcast_arrays(  File "lt;__array_function__ internalsgt;", line 5, in broadcast_arrays  File "C:ProgramDataAnaconda3envspythonProjectlibsite-packagesnumpylibstride_tricks.py", line 538, in broadcast_arrays  shape = _broadcast_shape(*args)  File "C:ProgramDataAnaconda3envspythonProjectlibsite-packagesnumpylibstride_tricks.py", line 420, in _broadcast_shape  b = np.broadcast(*args[:32]) ValueError: shape mismatch: objects cannot be broadcast to a single shape  

Спасибо!

Комментарии:

1.В чем заключается .shape ваше [estimators, depth, results] array «с»?