走向深蓝·初步学习

python的pipeline机制

参考博客
可以先从1.3.1开始看
邹博课程P9开始有涉及
奇技淫巧小技巧

LogisticRegressionCV的使用
参考博客

绘图技巧

plt.scatter()
参考博客
plt.rcParams
参考博客

回归分析

岭回归
参考博客
SVR
侧重于实例
侧重于参数
侧重于核函数
SVR实例

#!/usr/bin/python
# -*- coding:utf-8 -*-

import numpy as np
from sklearn import svm
import matplotlib.pyplot as plt


if __name__ == "__main__":
    N = 50
    np.random.seed(0)
    x = np.sort(np.random.uniform(0, 6, N), axis=0)
    y = 2*np.sin(x) + 0.1*np.random.randn(N)
    x = x.reshape(-1, 1)
    print('x =\n', x)
    print('y =\n', y)

    print('SVR - RBF')
    svr_rbf = svm.SVR(kernel='rbf', gamma=0.2, C=100)
    svr_rbf.fit(x, y)
    print('SVR - Linear')
    svr_linear = svm.SVR(kernel='linear', C=100)
    svr_linear.fit(x, y)
    print('SVR - Polynomial')
    svr_poly = svm.SVR(kernel='poly', degree=3, C=100)
    svr_poly.fit(x, y)
    print('Fit OK.')

    # 思考:系数1.1改成1.5
    x_test = np.linspace(x.min(), 1.1*x.max(), 100).reshape(-1, 1)
    y_rbf = svr_rbf.predict(x_test)
    y_linear = svr_linear.predict(x_test)
    y_poly = svr_poly.predict(x_test)

    name='RBF Kernel','Linear Kernel','Polynomial Kernel'
    reg=svr_rbf,svr_linear,svr_poly
    plt.figure(figsize=(7, 6), facecolor='w')
    plt.plot(x_test, y_rbf, 'r-', linewidth=2,  label = '%s, $R^2$=%.3f' % (name[0], reg[0].score(x, y)))
    plt.plot(x_test, y_linear, 'g-', linewidth=2, label = '%s, $R^2$=%.3f' % (name[1], reg[1].score(x, y)))
    plt.plot(x_test, y_poly, 'b-', linewidth=2, label = '%s, $R^2$=%.3f' % (name[2], reg[2].score(x, y)))
    plt.plot(x, y, 'mo', markersize=6, markeredgecolor='k')
    plt.scatter(x[svr_rbf.support_], y[svr_rbf.support_], s=200, c='r', marker='*', edgecolors='k', label='RBF Support Vectors', zorder=10)
    plt.legend(loc='lower left', fontsize=12)
    plt.title('SVR', fontsize=15)
    plt.xlabel('X')
    plt.ylabel('Y')
    plt.grid(b=True, ls=':')
    plt.tight_layout(2)
    plt.show()

numpy基本操作

简易版
复杂版

DataFrame基础知识点总结

参考博客
基本操作

XgBoost

概念详解

pip安装过程中可能遇到的问题

Traceback

pandas杂谈

set_option()函数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值