资源简介
经典模型对应的python代码经典模型对应的python代码
代码片段和文件信息
import numpy as np
import matplotlib.pyplot as plt
# Read dataset
x y = [] []
for sample in open(“../_Data/prices.txt“ “r“):
xx yy = sample.split(““)
x.append(float(xx))
y.append(float(yy))
x y = np.array(x) np.array(y)
# Perform normalization
x = (x - x.mean()) / x.std()
# Scatter dataset
plt.figure()
plt.scatter(x y c=“g“ s=20)
plt.show()
x0 = np.linspace(-2 4 100)
# Get regression model under LSE criterion with degree ‘deg‘
def get_model(deg):
return lambda input_x=x0: np.polyval(np.polyfit(x y deg) input_x)
# Get the cost of regression model above under given x y
def get_cost(deg input_x input_y):
return 0.5 * ((get_model(deg)(input_x) - input_y) ** 2).sum()
# Set degrees
test_set = (1 4 10)
for d in test_set:
print(get_cost(d x y))
# Visualize results
plt.scatter(x y c=“g“ s=20)
for d in test_set:
plt.plot(x0 get_model(d)() label=“degree = {}“.format(d))
plt.xlim(-2 4)
plt.ylim(1e5 8e5)
plt.legend()
plt.show()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\
文件 1184 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\.gitignore
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\
文件 120 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\balloon1.0(en).txt
文件 438 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\balloon1.0.txt
文件 438 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\balloon1.5.txt
文件 424 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\balloon2.0.txt
文件 5604839 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\bank1.0.txt
文件 8559529 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\cifar10.txt
文件 5205193 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\madelon.txt
文件 8103179 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\mnist.txt
文件 373704 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\mushroom.txt
文件 563 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\prices.txt
文件 379 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Data\test.txt
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\_Data\
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\_Data\_Cache\
文件 80 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\_Data\_Cache\LABEL_DIC.npy
文件 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\_Data\Put Training Dataset FOLDERS here
文件 6108 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\Main.py
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\Models\
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\Models\Extractors\
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\Models\Extractors\v3\
文件 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\Models\Extractors\v3\Put v3 Extractor here as ‘Model.pb‘
文件 2946 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\README.md
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\Test\
文件 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\Test\Put testing pictures here
文件 19644 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\ImageRecognition\ToolBox.py
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\NeuralNetworks\
目录 0 2018-06-21 15:25 MachineLearning-master\MachineLearning-master\_Dist\NeuralNetworks\_Tests\
............此处省略278个文件信息
相关资源
- numpy-1.13.1-cp27-none-win32.whl
- 中文文本聚类
- python 后台管理系统
- 声纹识别资料
- Introduction to time series.pdf + Deep Time Se
- OpenCV-Python中文教程
- 《廖雪峰Python2.7教程》高清完整PDF版
- Python标准库查询手册最新Python 3.3
- The Quick Python Book 3rd Edition.pdf
- Python学习思维导图
- OpenCV Python中文教程
- python for eclipse
- numpy-1.16.4.zip
- Python程序设计第3版- John M. Zelle 课件资
- Web Scraping with Python_Collecting Data from
- python TensorFlow 官方文档中文版
- Python3.6 中文文档.pdf
- 树莓派Python编程指南34705
- python项目源码
- Packt-Web.Scraping.with.Python.Richard Lawson
- Python编程实战:运用设计模式、并发
- 深入理解Python中文版.pdf
- QT5 Python GUI Programming Cookbook (2018)
- Hands-On Unsupervised Learning Using Python ep
- Jason Brownlee - Deep Learning with Python 高清
- Jason Brownlee - Machine learning Mastery with
- python27_d.dll
- python 情感分析 语料
- 上海交通大学Python课件ppt
-
树莓派人脸识别python代码及xm
l模型
评论
共有 条评论