joel-woodfield commited on
Commit
2c794eb
·
1 Parent(s): 0562a88

Force the inclusion of (0,0) in the parameter grid

Browse files
Files changed (1) hide show
  1. regularization.py +7 -0
regularization.py CHANGED
@@ -329,6 +329,13 @@ class Regularization:
329
  # build grid in parameter space
330
  w1 = np.linspace(w1_range[0], w1_range[1], num_dots)
331
  w2 = np.linspace(w2_range[0], w2_range[1], num_dots)
 
 
 
 
 
 
 
332
  W1, W2 = np.meshgrid(w1, w2)
333
 
334
  return W1, W2
 
329
  # build grid in parameter space
330
  w1 = np.linspace(w1_range[0], w1_range[1], num_dots)
331
  w2 = np.linspace(w2_range[0], w2_range[1], num_dots)
332
+
333
+ # include (0, 0)
334
+ if 0 not in w1:
335
+ w1 = np.insert(w1, np.searchsorted(w1, 0), 0)
336
+ if 0 not in w2:
337
+ w2 = np.insert(w2, np.searchsorted(w2, 0), 0)
338
+
339
  W1, W2 = np.meshgrid(w1, w2)
340
 
341
  return W1, W2