azizalto commited on
Commit
b673599
1 Parent(s): c5d63f2
ml_algorithms/linear_regression_gradient_descent.py CHANGED
@@ -158,6 +158,20 @@ def interactive_run():
158
  tex(f"y = {model.theta[0]:.1f} + {model.theta[1]:.1f} x") # print solution
159
  tex(f"loss = {model.loss_}")
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  # -- visualize
162
  import matplotlib.pyplot as plt
163
 
 
158
  tex(f"y = {model.theta[0]:.1f} + {model.theta[1]:.1f} x") # print solution
159
  tex(f"loss = {model.loss_}")
160
 
161
+ mark("> How to run")
162
+ mark(
163
+ """
164
+ ```python
165
+ X, y = random_data()
166
+ theta = [0, 0] # initial values
167
+ model = LinearRegressionGradient(theta)
168
+ model.gradientDescent(X, y, theta) # run "i.e. optimize thetas"
169
+ # print solution
170
+ # print(f"y = {model.theta[0]:.1f} + {model.theta[1]:.1f} x")
171
+ # print(f"loss = {model.loss_}")
172
+ ```
173
+ """
174
+ )
175
  # -- visualize
176
  import matplotlib.pyplot as plt
177