Update CM20315_Training_III.ipynb
This commit is contained in:
@@ -340,7 +340,7 @@
|
|||||||
" return compute_loss(data[0,:], data[1,:], model, phi_start+ gradient * dist_prop)\n",
|
" return compute_loss(data[0,:], data[1,:], model, phi_start+ gradient * dist_prop)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def line_search(data, model, phi, gradient, thresh=.00001, max_dist = 0.1, max_iter = 15, verbose=False):\n",
|
"def line_search(data, model, phi, gradient, thresh=.00001, max_dist = 0.1, max_iter = 15, verbose=False):\n",
|
||||||
" # Initialize four points along the rnage we are going to search\n",
|
" # Initialize four points along the range we are going to search\n",
|
||||||
" a = 0\n",
|
" a = 0\n",
|
||||||
" b = 0.33 * max_dist\n",
|
" b = 0.33 * max_dist\n",
|
||||||
" c = 0.66 * max_dist\n",
|
" c = 0.66 * max_dist\n",
|
||||||
@@ -371,7 +371,7 @@
|
|||||||
" # Rule #2 If point b is less than point c then\n",
|
" # Rule #2 If point b is less than point c then\n",
|
||||||
" # then point d becomes point c, and\n",
|
" # then point d becomes point c, and\n",
|
||||||
" # point b becomes 1/3 between a and new d\n",
|
" # point b becomes 1/3 between a and new d\n",
|
||||||
" # point c beocome 2/3 between a and new d \n",
|
" # point c becomes 2/3 between a and new d \n",
|
||||||
" if lossb < lossc:\n",
|
" if lossb < lossc:\n",
|
||||||
" d = c\n",
|
" d = c\n",
|
||||||
" b = a+ (d-a)/3\n",
|
" b = a+ (d-a)/3\n",
|
||||||
@@ -381,7 +381,7 @@
|
|||||||
" # Rule #2 If point c is less than point b then\n",
|
" # Rule #2 If point c is less than point b then\n",
|
||||||
" # then point a becomes point b, and\n",
|
" # then point a becomes point b, and\n",
|
||||||
" # point b becomes 1/3 between new a and d\n",
|
" # point b becomes 1/3 between new a and d\n",
|
||||||
" # point c beocome 2/3 between new a and d \n",
|
" # point c becomes 2/3 between new a and d \n",
|
||||||
" a = b\n",
|
" a = b\n",
|
||||||
" b = a+ (d-a)/3\n",
|
" b = a+ (d-a)/3\n",
|
||||||
" c = a+ 2*(d-a)/3\n",
|
" c = a+ 2*(d-a)/3\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user