kahramankostas/IoTDevIDv2

02.1 Feature importance voting and pre-assessment of features.ipynb Can‘t run successfully

kanglinew opened this issue · 14 comments

image
I am sorry to trouble u that this part of code in file 02.1 can't run successfully. Hope for your early reply. Thanks!

Thank you very much for your warning.
The Xverse library is not a current library and unfortunately, it crashes above python 3.6. This error you are getting is related to version conflict.
I just tried the codes. While Python3.6.6 does not have any problems, unfortunately, it does not work in newer versions (I tried 3.8, 3.9 and 3.10).

In this context, if you are having problems, please try Python 3.6.
If you do not want to change the installation on your computer, you can use a virtual machine or colab. A useful link for colab: https://www.datasciencelearner.com/change-python-version-in-google-colab-steps/

------------------------ Alternative (BETTER) solution. -----------------------------
The problem is due to the updating of the sklearn functions, if you make the following changes on line 131 of the _voting.py file, you will not have any problems in newer versions of Python.
rfe = RFE(clf, self.no_of_features) #old #from
rfe = RFE(estimator=clf,n_features_to_select=self.no_of_features) # new #to

Thank you
Kahraman

Thank you very much, Kahraman. You really helped me.
Your article has greatly inspired me, and I am looking forward to having more discussions with you in the future.

Thank you
Kangli Niu

You're welcome, Kangli.
I am glad that my article was useful to you. If there are any questions, I am always willing to help. Hoping to exchange more ideas in the future.

Thank you
Kahraman

Dear Sir,
I think I have solved the problem that I just submitted.
I rewrite the code “kfold = KFold(fold, True, int(rnd100)) ” into “ kfold = sklearn.model_selection.KFold(fold, shuffle=True, random_state=int(rnd100)) ”, then it works right.

@kahramankostas
Dear Sir,
I meet the same problem when I ran the code of 02.1;
The python version is 3.6.6;
could you give me some advice that I can deal with it?
image

The problem, as you have noticed, is that the use of the Kfold function in sklearn has changed.

In the new version the usage is as follows:
"kfold = sklearn.model_selection.KFold(n_splits=fold, shuffle=True, random_state=int(rnd*100))" s

I will update the code in this way.
Thanks for the warning

The problem, as you have noticed, is that the use of the Kfold function in sklearn has changed.

In the new version the usage is as follows: "kfold = sklearn.model_selection.KFold(n_splits=fold, shuffle=True, random_state=int(rnd*100))" s

I will update the code in this way. Thanks for the warning

Dear sir,
Would you please give me an requirement.txt of this project?
Thanks a lot~

thank you very much for your comment.
I uploaded requirement.txt.
If we run into any problems, I will try to help.
Thanks a lot

Dear Sir,
I used pip install pandas==1.35, but there is no version with 1.3.5 for python 3.6.X;
image

and, I also checked the “https://www.lfd.uci.edu/~gohlke/pythonlibs/”;
image
pandas==1.3.5 depends on python 3.7 or more,

therefore, the requirements.txt is right?

and when I ran the code “from sklearn.metrics import balanced_accuracy_score”, it reports an error that there is no module with balanced_accuracy_source.

Look for your reply.

It gives problems in xverse for newer versions of Python. If you are using 3.6, you don't need to specify the version, you shouldn't have any problems.

206174166-2357c203-a1c1-4ebe-b90b-9b34d2c47ef5
If you get the error in the screenshot, you should:
The problem is due to the updating of the sklearn functions, if you make the following changes on line 131 of the _voting.py file, you will not have any problems in newer versions of Python.
rfe = RFE(clf, self.no_of_features) #old-from #replace this line with the following
rfe = RFE(estimator=clf,n_features_to_select=self.no_of_features) # new-to # new line

balanced_accuracy_score error looks interesting.
the following link may help. but if you provide more information (e.g. ss) I can help too.

https://stackoverflow.com/questions/55111886/cannot-import-name-balanced-accuracy-score-from-scikit-learn

I forked the xverse module and fixed the bugs caused by the panda and sklearn updates.
If you use my version in the requirements.txt you should have no problems.
If you want to install it manually, you can install it as follows:

pip install git+https://github.com/kahramankostas/XuniVerse

Can i run this project in colab ?? i try it but colab run on notbook

@kahramankostas can you help me to run project in local ?
beacouse give me more error

@AhmedmostafaElabdli1 If you share your error screenshots, I will help as much as I can.