吴恩达Coursera, 机器学习专项课程, Machine Learning:Unsupervised Learning, Recommenders, Reinforcement Learning第二周所有jupyter notebook文件2:
吴恩达Coursera, 机器学习专项课程, Machine Learning:Unsupervised Learning, Recommenders, Reinforcement Learning第二周所有jupyter notebook文件(包括实验室练习文件)2
本次作业
Exercise 1
# GRADED_FUNCTION: sq_dist
# UNQ_C2
def sq_dist(a,b):
"""
Returns the squared distance between two vectors
Args:
a (ndarray (n,)): vector with n features
b (ndarray (n,)): vector with n features
Returns:
d (float) : distance
"""
### START CODE HERE ###
d = np.sum((a-b)**2)
### END CODE HERE ###
return (d)