diff --git a/anfis.py b/anfis.py index 7555b2a..a2217e9 100644 --- a/anfis.py +++ b/anfis.py @@ -224,6 +224,8 @@ def fit_coeff(self, x, weights, y_actual): # Use gels to do LSE, then pick out the solution rows: try: coeff_2d, _ = torch.gels(y_actual_2d, weighted_x_2d) + except AttributeError: + coeff_2d, _ = torch.lstsq(y_actual_2d, weighted_x_2d) except RuntimeError as e: print('Internal error in gels', e) print('Weights are:', weighted_x)