jfpower / anfis-pytorch

Implementation of ANFIS using the pyTorch framework
MIT License
124 stars 43 forks source link

Use lstsq instead of gels for anfis.py in line 226 #3

Open GGuedesAB opened 3 years ago

GGuedesAB commented 3 years ago

Hi! The "gels" operator was deprecated in release 1.3.0, according to this issue from pytorch's repository: https://github.com/pytorch/pytorch/issues/31700. It is recomended to use "lstsq" instead of "gels". Here is the error I get when I run the following command from within the directory of the repository: $ python3 jang_examples.py 1

Traceback (most recent call last):
  File "jang_examples.py", line 294, in <module>
    train_anfis(model, train_data, 20, show_plots)
  File "${workspace}/anfis-pytorch/experimental.py", line 168, in train_anfis
    train_anfis_with(model, data, optimizer, criterion, epochs, show_plots)
  File "${workspace}/anfis-pytorch/experimental.py", line 145, in train_anfis_with
    model.fit_coeff(x, y_actual)
  File "${workspace}/anfis-pytorch/anfis.py", line 342, in fit_coeff
    self.layer['consequent'].fit_coeff(x, self.weights, y_actual)
  File "${workspace}/anfis-pytorch/anfis.py", line 226, in fit_coeff
    coeff_2d, _ = torch.gels(y_actual_2d, weighted_x_2d)
AttributeError: module 'torch' has no attribute 'gels'

System information:

Python package information: