首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >mglearn.plots.plot_2d_separator (eps=0.5),那是什么,"eps"?

mglearn.plots.plot_2d_separator (eps=0.5),那是什么,"eps"?
EN

Stack Overflow用户
提问于 2021-06-05 08:07:33
回答 1查看 510关注 0票数 0

我从“Python机器学习入门”一书中学习Python

在这本书中,使用了下面的功能。

但我不明白参数“X”是如何工作的,以及参数"eps“的必要性。

你能帮帮我吗?

代码语言:javascript
运行
复制
def plot_2d_classification(classifier, X, fill=False, ax=None, eps=None,
                           alpha=1, cm=cm3):
    # multiclass
    if eps is None:
        eps = X.std() / 2.

    if ax is None:
        ax = plt.gca()

    x_min, x_max = X[:, 0].min() - eps, X[:, 0].max() + eps
    y_min, y_max = X[:, 1].min() - eps, X[:, 1].max() + eps
    xx = np.linspace(x_min, x_max, 1000)
    yy = np.linspace(y_min, y_max, 1000)

    X1, X2 = np.meshgrid(xx, yy)
    X_grid = np.c_[X1.ravel(), X2.ravel()]
    decision_values = classifier.predict(X_grid)
    ax.imshow(decision_values.reshape(X1.shape), extent=(x_min, x_max,
                                                         y_min, y_max),
              aspect='auto', origin='lower', alpha=alpha, cmap=cm)
    ax.set_xlim(x_min, x_max)
    ax.set_ylim(y_min, y_max)
    ax.set_xticks(())
    ax.set_yticks(())
EN

回答 1

Stack Overflow用户

发布于 2022-08-23 12:34:16

我认为每股收益是每平方的一个元素。它决定了数据整体的紧凑性。当您继续增加eps的值时,您的所有数据点都会聚成一个点。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67847651

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档