吴恩达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" 
)
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐