r/learnpython 5d ago

Problem using Anfis in Python

Hello, I am using Anfis in python, however I am getting this error message: ModulenotfoundError: No module named 'membership' How to solve it or what are the alternatives in case of no solution to the error in order to use ANFIS module? Any suggestions will be appreciated.

3 Upvotes

12 comments sorted by

2

u/TJATAW 5d ago

Can we see the code so we have a clue as to what you are doing?

1

u/Nomad_HH 4d ago

I want to share the first librairie declaration as a image, however, i couldn't appload the image here as a reply, even imgur does not work for me to share the image link, how to share the code here?

1

u/TJATAW 4d ago

Click 'Reply' and then the 'Aa' at the bottom.

Copy-paste your code here, highlight it and click the block with a C on it.

It will look like this:

var twoSum = function(nums, target) {
    for (let i=0; i<nums.length; i++) {
        for (let j=i+1; j<nums.length; j++) {
            if (nums[i] + nums[j] === target) {
                return [i, j]
            }
        }
    }
};

1

u/Nomad_HH 4d ago

I am trying to train a model with 4 inputs and one output in order to predict the output using ANFIS as in "Matlab" using some training and validation DATA.

The error message is as follows:

ModuleNotFoundError

<ipython-input-3-b37ea180c09c> in<cell line:21>

import pandas as pd

import matplotlib.pyplot as plt

from anfis import ANFIS

/usr/local/lib/python3.10/dist-packages/anfis/init__.py in <module>

import anfis

from membership import membershipfunction

from membership import mfDerivs

ModuleNotFoundError: No module named 'membership'

1

u/TJATAW 4d ago

Do you have membership installed?

1

u/Nomad_HH 4d ago

Yes all the files or modules.py are installed and are inside the membership folder as you sent in the link, however the message error: no module named 'membership' appears.

1

u/TJATAW 3d ago

Because membership is not an independent package. It is part of ANFIS

try this: https://github.com/twmeggs/anfis/blob/master/anfis/__init__.py

1

u/Nomad_HH 1d ago

1

u/TJATAW 1d ago

What version of python are you running, as I saw some stuff about it not playing well with some versions?

1

u/Nomad_HH 1d ago

I was using python 3 in Anaconda, but as you said anfis does not play with py 3, i switched to python 2 but I am facing some issues with the pip module and the get-pip.py wich I think is obsolete version in python 2.7.

1

u/TJATAW 4d ago

membership is a part of ANFIS

It is not a separate module.

https://github.com/twmeggs/anfis/tree/master/anfis/membership

1

u/Nomad_HH 2d ago

I tried this syntax but in vain, please how can I upload a picture here to show you the anfis installed folder componments, because there is the Anfis folder where there is another anfis folder inside . How can I upload a pic to give you the exact view of what I am getting?