I have a dataset which looks like this-
I am trying to use chi2 as a feature selction algorithm on it.Here is the code
dataset = pd.read_csv('small_dataset.csv') print(dataset.shape) X = dataset.iloc[:, 1:106].values y = dataset.iloc[:,0].values print(sklearn.feature_selection.chi2(X, y))
I tried to validate the answers from sklearn and the formula which is
so I took the first feature and computed the A B C D which are 0 19 73 73 and N is 146.So the X2 value coming is 21 but in sklearn its coming 579.
What am I doing wrong?