Commit 8b4ed382 authored by Dr.李's avatar Dr.李

fixed exception type miss match

parent ae80d282
...@@ -53,7 +53,7 @@ def neutralize(x: np.ndarray, ...@@ -53,7 +53,7 @@ def neutralize(x: np.ndarray,
else: else:
try: try:
b = ls_fit(x, y, weights) b = ls_fit(x, y, weights)
except ValueError: except np.linalg.linalg.LinAlgError:
b = ls_fit_pinv(x, y, weights) b = ls_fit_pinv(x, y, weights)
res = ls_res(x, y, b) res = ls_res(x, y, b)
...@@ -72,7 +72,7 @@ def _sub_step(x, y, w, curr_idx, res) -> Tuple[np.ndarray, np.ndarray]: ...@@ -72,7 +72,7 @@ def _sub_step(x, y, w, curr_idx, res) -> Tuple[np.ndarray, np.ndarray]:
curr_x, curr_y, curr_w = x[curr_idx], y[curr_idx], w[curr_idx] curr_x, curr_y, curr_w = x[curr_idx], y[curr_idx], w[curr_idx]
try: try:
b = ls_fit(curr_x, curr_y, curr_w) b = ls_fit(curr_x, curr_y, curr_w)
except ValueError: except np.linalg.linalg.LinAlgError:
b = ls_fit_pinv(curr_x, curr_y, curr_w) b = ls_fit_pinv(curr_x, curr_y, curr_w)
res[curr_idx] = ls_res(curr_x, curr_y, b) res[curr_idx] = ls_res(curr_x, curr_y, b)
return curr_x, b return curr_x, b
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment