chapter_3.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:python-machine-learning-book 作者: jeremyn 项目源码 文件源码
def plot_xor():
    np.random.seed(0)
    X_xor = np.random.randn(200, 2)
    y_xor = np.logical_xor(X_xor[:, 0] > 0, X_xor[:, 1] > 0)
    y_xor = np.where(y_xor, 1, -1)

    svm = SVC(kernel='rbf', random_state=0, gamma=0.1, C=10.0)
    svm.fit(X_xor, y_xor)
    plot_decision_regions(X_xor, y_xor, classifier=svm)

    plt.legend(loc='upper left')
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号