资源简介
神经网络和深度学习——吴恩达 第三周编程作业相关文件

代码片段和文件信息
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import sklearn.datasets
import sklearn.linear_model
def plot_decision_boundary(model X y):
# Set min and max values and give it some padding
x_min x_max = X[0 :].min() - 1 X[0 :].max() + 1
y_min y_max = X[1 :].min() - 1 X[1 :].max() + 1
h = 0.01
# Generate a grid of points with distance h between them
xx yy = np.meshgrid(np.arange(x_min x_max h) np.arange(y_min y_max h))
# Predict the function value for the whole grid
Z = model(np.c_[xx.ravel() yy.ravel()])
Z = Z.reshape(xx.shape)
# Plot the contour and training examples
plt.contourf(xx yy Z cmap=plt.cm.Spectral)
plt.ylabel(‘x2‘)
plt.xlabel(‘x1‘)
plt.scatter(X[0 :] X[1 :] c=np.squeeze(y) cmap=plt.cm.Spectral)
def sigmoid(x):
s = 1/(1+np.exp(-x))
return s
def load_planar_dataset():
np.random.seed(1)
m = 400 # number of examples
N = int(m/2) # number of points per class
D = 2 # dimensionality
X = np.zeros((mD)) # data matrix where each row is a single example
Y = np.zeros((m1) dtype=‘uint8‘) # labels vector (0 for red 1 for blue)
a = 4 # maximum ray of the flower
for j in range(2):
ix = range(N*jN*(j+1))
t = np.linspace(j*3.12(j+1)*3.12N) + np.random.randn(N)*0.2 # theta
r = a*np.sin(4*t) + np.random.randn(N)*0.2 # radius
X[ix] = np.c_[r*np.sin(t) r*np.cos(t)]
Y[ix] = j
X = X.T
Y = Y.T
return X Y
def load_extra_datasets():
N = 200
noisy_circles = sklearn.datasets.make_circles(n_samples=N factor=.5 noise=.3)
noisy_moons = sklearn.datasets.make_moons(n_samples=N noise=.2)
blobs = sklearn.datasets.make_blobs(n_samples=N random_state=5 n_features=2 centers=6)
gaussian_quantiles = sklearn.datasets.make_gaussian_quantiles(mean=None cov=0.5 n_samples=N n_features=2 n_classes=2 shuffle=True random_state=None)
no_structure = np.random.rand(N 2) np.random.rand(N 2)
return noisy_circles noisy_moons blobs gaussian_quantiles no_structure
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2171 2019-01-17 21:15 神经网络和深度学习—吴恩达 第三周编程作业相关文件\planar_utils.py
文件 4171 2019-01-17 21:16 神经网络和深度学习—吴恩达 第三周编程作业相关文件\test_cases.py
目录 0 2019-01-20 13:37 神经网络和深度学习—吴恩达 第三周编程作业相关文件\
- 上一篇:IP网络监控方案平面图
- 下一篇:微信小程序云开发-数据库添加分页列表删除
相关资源
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- Python中Numpy库最新教程
- 用python编写的移动彩信的发送程序
- Python全栈学习笔记面向对象大作业:
- python实现的ftp自动上传、下载脚本
- Python版的A*寻路算法
- IronPython IDE
- pip-10.0.1.tar.gz
- Data Science from Scratch 2nd Edition
- shape_predictor_68_face_landmarks.dat.bz2 68个标
- 爬取豆瓣电影TOP250程序,包含非常详
- 中文维基百科语料库百度网盘网址.
- MSCNN_dehaze.rar
- 爬取豆瓣排行榜电影数据(含GUI界面
- 字典文本资源
- Brainfuck / OoK 解码脚本
- 案例实战信用卡欺诈检测数据集
- 招商策略_抱团启示录那些年我们一起
- sip-4.19.zip
- 树莓派3b+学习使用教程
- numpy 中文学习手册
- pytorch-1.4.0-py3.7_cpu_0.tar.bz2
- 机器学习实战 高清完整版PDF
- 泰坦尼克号0.81准确率实验报告.docx
-
abaqus sc
ripting reference manual.pdf - 网页版聊天程序--网络程序设计课程大
- Give Me Some Credit
-
ba
semap安装出错时,正确得pyproj文件 - 微信头像拼接工具
- 统计思维:程序员数学之概率统计第
评论
共有 条评论