-
大小: 8KB文件类型: .py金币: 1下载: 0 次发布日期: 2021-01-05
- 语言: Python
- 标签: init_utils coursera
资源简介
coursera的吴恩达的课编程练习所需的所需包和数据,可以方便学员自己在本地练习
代码片段和文件信息
import numpy as np
import matplotlib.pyplot as plt
import h5py
import sklearn
import sklearn.datasets
def sigmoid(x):
“““
Compute the sigmoid of x
Arguments:
x -- A scalar or numpy array of any size.
Return:
s -- sigmoid(x)
“““
s = 1/(1+np.exp(-x))
return s
def relu(x):
“““
Compute the relu of x
Arguments:
x -- A scalar or numpy array of any size.
Return:
s -- relu(x)
“““
s = np.maximum(0x)
return s
def forward_propagation(X parameters):
“““
Implements the forward propagation (and computes the loss) presented in Figure 2.
Arguments:
X -- input dataset of shape (input size number of examples)
Y -- true “label“ vector (containing 0 if cat 1 if non-cat)
parameters -- python di
评论
共有 条评论