I have a feature vector table which looks like this-

enter image description here

This a table with 156 columns or features.I want to apply feature selection algorithm to this before applyinh my classification model.

This is what I am using-

dataset = pd.read_csv('.csv')
X = dataset.iloc[:, 1:157].values
y = dataset.iloc[:,0].values


scaler = MinMaxScaler()
MinMaxScaler(copy=True, feature_range=(0, 1))

X_normalized = scaler.transform(X)

##feature selection

sel = SelectKBest(chi2, k='all')

sel.fit_transform(X_normalized, y)


this is the result of print(sel.scores_) I am getting-

enter image description here

As can be seen they are not all between 0 and 1.

I a referring this research paper as my source-

enter image description here

enter image description here



I don't know what is your source that said that value of chi-square should be between 0 and 1. Imagine as in that equation in the picture say two terms t and c always co-occur, meaning D(t|~c)=0 (number of documents with no c but t in them) and D(c|~t)=0 (number of documents with c in them but no t). This means the equation in the snap reduces down to

$\chi^2(t, c) = N*(AD)^2/A^2D^2 = N$.

Edit 1:

After reading your comment, I understood you are confused regarding the 'normalised' part. A normalised value does not always mean a scaled value between 0 and 1. Normalised value does mean a value that is scaled appropriately for comparing and in my opinion, the denominator gives that comparable effect. The type of normalisation that you are associating this situation to is feature scaling. Check out normalization.

  • $\begingroup$ I added the source in the question $\endgroup$ Jun 10 '18 at 13:18
  • $\begingroup$ I am still unable to find the part in the paper where it mentions that the value should be less than 1. Can you point me to it? $\endgroup$ Jun 10 '18 at 13:27
  • $\begingroup$ I have added the picture in the question...in the paper its under the chi square section.....X2 is a normalized value... $\endgroup$ Jun 10 '18 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.