title: Perform Chi-2 feature selection on TF and TF*IDF vectors
body: <p>I'm experimenting with Chi-2 feature selection for some text classification tasks.
  I understand that Chi-2 test checks the dependencies B/T two <strong>categorical</strong> variables, so if we perform Chi-2 feature selection for a binary text classification problem with binary BOW vector representation, each Chi-2 test on each (feature,class) pair would be a very straightforward Chi-2 test with 1 degree of freedom.   </p>
  
  <p>Quoting from the documentation: <a href="http://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.chi2.html#sklearn.feature_selection.chi2" rel="noreferrer">http://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.chi2.html#sklearn.feature_selection.chi2</a>, </p>
  
  <blockquote>
    <p>This score can be used to select the n_features features with the highest values for the χ² (chi-square) statistic from X, which must contain booleans or frequencies (e.g., term counts in document classification), relative to the classes.</p>
  </blockquote>
  
  <p>It seems to me that we we can also perform Chi-2 feature selection on DF (word counts) vector presentation. My 1st question is: how does sklearn discretize the integer-valued feature into categorical?</p>
  
  <p>My second question is similar to the first. From the demo codes here: <a href="http://scikit-learn.sourceforge.net/dev/auto_examples/document_classification_20newsgroups.html" rel="noreferrer">http://scikit-learn.sourceforge.net/dev/auto_examples/document_classification_20newsgroups.html</a></p>
  
  <p>It seems to me that we can also perform Chi-2 feature selection on a TF*IDF vector representation. How sklearn perform Chi-2 feature selection on real-valued features? </p>
  
  <p>Thank you in advance for your kind advise!</p>