How to implement the knowledge of Linear Regression using python
To conclude the steps learned this week, 实际上就三个步骤,
compute_cost
compute_gradient
gradient_descent
第一步 定义compute_cost
理论依据

First part: To begin with
import numpy as np


chatgpt给出的 X@w 是计算矩阵的快捷方法
第二部分
定义compute_gradient



第三部分
定义gradient_descent


Week 2结束了 从最开始的数学公式讲解分析到最后的python应用,抽丝剥茧的说明了推算步骤,就算是最后可以只有一行代码就可以解决的捷径,但背后的理论支持用python一点点构建出来的时候还是像做建筑一样一层一层叠加累积。
Comments