资源简介
经典模型对应的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个文件信息
相关资源
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
- 量化交易(附python常见函数的使用方
- python 名字用字排行
评论
共有 条评论