既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
目录
1. 代码运行结果截图(main函数里的内容不要修改)编辑
5. cross entropy loss function公式
【实验目标】
1.熟悉numpy的一些基本函数
2.理解sigmoid, softmax, cross entropy loss等函数
【实验内容】
使用numpy实现深度学习任务中的一些基本操作,包括以下函数:
- sigmoid function
def sigmoid(x):
"""
Compute the sigmoid of x
Arguments:
x -- A scalar or numpy array of any size
Return:
s -- sigmoid(x)
"""
# write your code here
fx = []
for num in x:
fx.append(1 / (1 + math.exp(-num)))
return fx
- sigmoid gradient function
def sigmoid_derivative(x):
"""
Compute the gradient (also called the slope or derivative) of the sigmoid function with respect to its input x.
You can store the output of the sigmoid function into variables and then use it to calculate the gradient.
Arguments:
x -- A scalar or numpy array
Return:
ds -- Your computed gradient.
"""
# write your code here
y = []
fx = []
for num in x:
y.append(1 / (1 + math.exp(-num)))
for n in y:
fx.append(n * (1 - n))
return fx
- softmax function
def softmax(x):
"""Calculates the softmax for the input x.
Argument:
x -- A numpy matrix of shape (n,)
Returns:
s -- A numpy matrix equal to the softmax of x, of shape (n,)
"""
# write your code here
x_exp = np.exp(x)
x_sum = np.sum(x_exp, axis=0, keepdims=True)
fx = x_exp / x_sum
return fx
- cross entropy loss function
def cross_entropy_loss(target, prediction):
"""
Compute the cross entropy loss between target and prediction
Arguments:
target -- the real label, a scalar or numpy array size = (n,)
prediction -- the output of model, a scalar or numpy array, size=(n, c)
Return:
mean loss -- cross_entropy_loss(target, prediction)
"""
# write your code here
batch_loss = 0.
for i in range(prediction.shape[0]):
numerator = np.exp(prediction[i, target[i]]) # 分子
denominator = np.sum(np.exp(prediction[i, :])) # 分母
# Calculating losses
loss = -np.log(numerator / denominator)
batch_loss += loss
return batch_loss
【代码要求】
1.按代码模板实现函数功能
【文档要求】
1. 代码运行结果截图(main函数里的内容不要修改)
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!**
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新