添加--svm回归示例--添加注释

This commit is contained in:
haotian 2025-02-05 15:20:13 +08:00
parent 0cd8099f2e
commit c3fa1a3cda

View File

@ -11,6 +11,7 @@ X = np.sort(5 * np.random.rand(40, 1), axis=0)
y = np.sin(X).ravel()
# 为了使问题更具挑战性,我们向目标变量添加一些噪声
# y[::5]每隔5个元素取一个值, 总共40个元素,即最后取8个值 , np.random.rand(8) 随机生成一个值在[0,1)之间的形状为[8, 1]的数组,所以形状正好相加.
y[::5] += 3 * (0.5 - np.random.rand(8))
# 将数据集拆分为训练集和测试集