【发布时间】:2023-01-28 02:25:17
【问题描述】:
有什么方法可以为 SVM 预测值与实际值制作可读的散点图吗?我正在使用以下代码:
y_test_shape = range(dataset.shape[0])
y_pred_shape = np.random.randint(0, dataset.shape[0], dataset.shape[0])
def plotGraph(y_test_shape, y_pred_shape,title):
plt.scatter(range(len(y_test_shape)), y_test_shape, color='blue', s=20)
plt.scatter(range(len(y_pred_shape)), y_pred_shape, color='red', marker='+', s=20)
plt.title(title)
return
plotGraph(y_test_shape, y_pred_shape, "Convolutional Neural Network: Actual vs Predicted")
plt.show()
输出: enter image description here
我正在绘制不同颜色的 SVM 实际值与预测值的散点图。我的数据是二进制的 (0,1)。我想用不同的颜色区分 0 和 1。像这样: enter image description here 有什么办法可以这样做吗?
【问题讨论】:
标签: python scatter-plot