Feature slection using MRMR

Viewed 277

Can any one help me to solve the problem of running MRMR on a csv dataset. When I run the module on an array data set it works like that

Code no.1:

import numpy as np

import pandas as pd

from sklearn.datasets import make_classification

from IPython.core.interactiveshell import InteractiveShell

InteractiveShell.ast_node_interactivity = "all"

X, y = make_classification(n_samples=10000,
                       n_features=6,
                       n_informative=3,
                       n_classes=2,
                       random_state=0,
                       shuffle=False)

#Creating a dataFrame
df = pd.DataFrame({'Feature 1':X[:,0],
                              'Feature 2':X[:,1],
                              'Feature 3':X[:,2],
                              'Feature 4':X[:,3],
                              'Feature 5':X[:,4],
                              'Feature 6':X[:,5],
                              'Class':y})


y_train = df['Class']
X_train = df.drop('Class', axis=1)

#Applying MRMR using pymrmr Contains MID Which is published by the author The link is https://github.com/fbrundu/pymrmr

import pymrmr
pymrmr.mRMR(df, 'MID',6) 

But when I apply pymrmr on a csv dataset it makes error

Code no.2 :

In [1]: import pandas as pd

In [2]: import pymrmr

In [3]: df = pd.read_csv('test.csv')

In [4]: pymrmr.mRMR(df, 'MIQ', 10)

The error :

 TypeError Traceback (most recent call last) 
~\AppData\Local\Temp/ipykernel_7432/2484935427.py in ----> 1 pymrmr.mRMR (df, 'MID', 10)

C:\ProgramData\Anaconda3\lib\site-packages\pymrmr\pymrmr.pyx in pymrmr.mRMR()

C:\ProgramData\Anaconda3\lib\site-packages\pymrmr.cp39-win_amd64.pyd in vector.from_py.__pyx_convert_vector_from_py_int()

 C:\ProgramData\Anaconda3\lib\site-packages\pymrmr.cp39-win_amd64.pyd in vector.from_py.__pyx_convert_vector_from_py_int()

TypeError: an integer is required

Note that : I tried with different datasets & I use python 3.9 throw anaconda

0 Answers
Related