我正在尝试显示3d点和相应的线性回归平面。但是根据角度,某些点要么清晰可见,要么我看穿了它们的表面,或者尽管它们位于线框的上侧,但我根本看不到它们。不幸的是,我无法添加更多图像...我该怎么做才能使点变得完全不透明且可以从任何角度看到,而这些点更靠近“凸轮”?
有一些相应的代码:
def display_points(ax:Axes3D, X):
edu, seniority, income = X.T
s = ax.scatter(edu, seniority, income, c='red', alpha=1, depthshade=False)
s.set_edgecolors = s.set_facecolors = lambda *args: None
def display_predictions(ax:Axes3D, xx1, xx2, model):
X_grid = np.column_stack((xx1.ravel(), xx2.ravel()))
zz = model.predict(X_grid).reshape(xx1.shape)
ax.plot_wireframe(xx1, xx2, zz, alpha=1)
def display_perpendiculars(ax:Axes3D, X, y_true, y_pred):
for x_row, y_t, y_p in zip(X, y_true, y_pred):
x1, x2 = x_row
ax.plot(xs=[x1, x1], ys=[x2, x2], zs=[y_t, y_p], color='black', alpha=0.5)