Skip to content

Commit 3d01e28

Browse files
committed
backport 98bef2c
1 parent c67fbe0 commit 3d01e28

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

disstans/solvers.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def linear_regression(ts: Timeseries,
610610
else:
611611
GtWG, GtWd = models.build_LS(ts, G, obs_indices, use_data_var=use_data_variance,
612612
use_data_cov=use_data_covariance)
613-
bounds = ((bd_lower, bd_upper) if check_constraints
613+
bounds = ((bd_lower.ravel(), bd_upper.ravel()) if check_constraints
614614
else (-np.inf, np.inf))
615615
params = sp.optimize.lsq_linear(GtWG, GtWd, bounds=bounds).x.reshape(num_obs, num_comps)
616616
if formal_covariance:
@@ -741,9 +741,9 @@ def ridge_regression(ts: Timeseries,
741741
use_data_cov=use_data_covariance)
742742
reg = np.diag((reg_indices.reshape(-1, 1) * penalty.reshape(1, -1)).ravel())
743743
GtWGreg = GtWG + reg
744-
bounds = ((bd_lower, bd_upper) if check_constraints
744+
bounds = ((bd_lower.ravel(), bd_upper.ravel()) if check_constraints
745745
else (-np.inf, np.inf))
746-
params = sp.optimize.lsq_linear(GtWGreg, GtWd).x.reshape(num_obs, num_comps)
746+
params = sp.optimize.lsq_linear(GtWGreg, GtWd, bounds=bounds).x.reshape(num_obs, num_comps)
747747
if formal_covariance:
748748
cov = sp.linalg.pinvh(GtWGreg)
749749

0 commit comments

Comments
 (0)