# View more python learning tutorial on my Youtube and Youku channel!!!

# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial """
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
"""
from __future__ import print_function
from sklearn.learning_curve import validation_curve
from sklearn.datasets import load_digits
from sklearn.svm import SVC
import matplotlib.pyplot as plt
import numpy as np digits = load_digits()
X = digits.data
y = digits.target
param_range = np.logspace(-6, -2.3, 5)
train_loss, test_loss = validation_curve(
SVC(), X, y, param_name='gamma', param_range=param_range, cv=10,
scoring='mean_squared_error')
train_loss_mean = -np.mean(train_loss, axis=1)
test_loss_mean = -np.mean(test_loss, axis=1) plt.plot(param_range, train_loss_mean, 'o-', color="r",
label="Training")
plt.plot(param_range, test_loss_mean, 'o-', color="g",
label="Cross-validation") plt.xlabel("gamma")
plt.ylabel("Loss")
plt.legend(loc="best")
plt.show()

最新文章

  1. ASM FailGroup验证
  2. Github-素材篇
  3. sqlmap用户手册
  4. 手机屏幕滑动效果框架——flipsnap
  5. Liferay 6.2 改造系列之十一:默认关闭CDN动态资源
  6. iOS真机调试问题-App installation failed,The maximum number of apps for free development profiles has been reached.
  7. iATKOS v7硬盘安装教程(硬盘助手+变色龙安装版)
  8. 使用VS2010开发Qt程序的一点经验(转载)
  9. 如何用Ajax实现地址栏省市级联动(数据库表数据源)
  10. Only the original thread that created a view hierarchy can touch its views
  11. CentOS5.6下安装Oracle10G软件 【保留报错经验】
  12. 想在网上保持匿名?教你用Linux如何实现!
  13. Beta冲刺 第三天
  14. Python源码学习(一)
  15. lncRNA研究利器之"TANRIC"
  16. nginx 反向代理 502 Bad Gateway
  17. IntelliJ 禁用 Search Everywhere
  18. 嵌套循环连接(nested loops join)原理
  19. Hibernate 中一级缓存和快照区的理解
  20. Eclipse NDK 打印LOG信息(都在jni目录下操作)

热门文章

  1. 001.AD域控简介及使用
  2. 04373 C++程序设计 2019版 第一章习题五、程序设计题
  3. [luogu5464]缩小社交圈
  4. Devs--开源规则引擎介绍
  5. 群晖ping自动关机
  6. Codeforces 1476G - Minimum Difference(带修莫队+根号平衡)
  7. HDU 6755 - Fibonacci Sum(二项式定理+推式子)
  8. intent.getSerializableExtra(转)
  9. C/C++ Qt StandardItemModel 数据模型应用
  10. hbase调优