k-近邻算法进行回归拟合

%matplotlib inline import matplotlib.pyplot as plt import numpy as np # 生成训练样本 n_dots = 40 X = 5 * np.random.rand(n_dots, 1) y = np.cos(X).ravel() # 添加一些噪声 y += 0.2 * np.random.rand(n_dots) - 0.1 # 训
相关文章
相关标签/搜索