吴恩达Coursera, 机器学习专项课程, Machine Learning:Advanced Learning Algorithms第二周编程作业

吴恩达Coursera, 机器学习专项课程, Machine Learning:Advanced Learning Algorithms第二周所有jupyter notebook文件:

吴恩达,机器学习专项课程, Advanced Learning Algorithms第二周所有Python编程文件

本次作业

Exercise 1

# UNQ_C1
# GRADED CELL: my_softmax
def my_softmax(z):
""" Softmax converts a vector of values to a probability distribution.
Args:
z (ndarray (N,)) : input data, N features
Returns:
a (ndarray (N,)) : softmax of z
"""
### START CODE HERE ###
ez = np.exp(z) #element-wise exponenial
a = ez/np.sum(ez)
### END CODE HERE ###
return a

Exercise 2

# UNQ_C2
# GRADED CELL: Sequential model
tf.random.set_seed(1234) # for consistent results
model = Sequential(
[
### START CODE HERE ###
tf.keras.Input(shape=(400,)), #specify input shape
Dense(25, activation = 'relu', name = "L1"),
Dense(15, activation = 'relu', name = "L2"),
Dense(10, activation = 'linear', name = "L3")
### END CODE HERE ###
], name = "my_model"
)
posted @   楚千羽  阅读(591)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示