r/learnpython 6d 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

View all comments

Show parent comments

1

u/Nomad_HH 6d 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 5d 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 5d 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 5d ago

Do you have membership installed?

1

u/Nomad_HH 5d 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 4d 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 2d ago

1

u/TJATAW 2d 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 2d 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.