class_docstr: Test class for preprocessing tests.
docstr: Test SelectByMinCount feature selector.
docstr_tok: ["Test","SelectByMinCount","feature","selector","."]
code: def test_SelectByMinCount(self):
      """Test SelectByMinCount feature selector."""
      m2 = [
          [0.001, 0.0, 0.0, 0.0],
          [0.00001, -2.0, 0.0, 0.0],
          [0.001, 0.0, 0.0, 4.0],
          [0.0101, -200.0, 0.0, 0.0],
      ]
  
      # default should keep all nonzero features (i.e. ones that appear 1+ times)
      feat_selector = SelectByMinCount()
      expected = np.array(
          [
              [0.001, 0.0, 0.0],
              [0.00001, -2.0, 0.0],
              [0.001, 0.0, 4.0],
              [0.0101, -200.0, 0.0],
          ]
      )
      assert_array_equal(
          feat_selector.fit_transform(np.array(m2)), expected
      )
      assert_array_equal(
          feat_selector.fit_transform(sp.csr_matrix(m2)).toarray(),
          expected,
      )
  
      # keep features that happen 2+ times
      feat_selector = SelectByMinCount(min_count=2)
      expected = np.array(
          [
              [0.001, 0.0],
              [0.00001, -2.0],
              [0.001, 0.0],
              [0.0101, -200.0],
          ]
      )
      assert_array_equal(
          feat_selector.fit_transform(np.array(m2)), expected
      )
      assert_array_equal(
          feat_selector.fit_transform(sp.csr_matrix(m2)).toarray(),
          expected,
      )
  
      # keep features that happen 3+ times
      feat_selector = SelectByMinCount(min_count=3)
      expected = np.array([[0.001], [0.00001], [0.001], [0.0101]])
      assert_array_equal(
          feat_selector.fit_transform(np.array(m2)), expected
      )
      assert_array_equal(
          feat_selector.fit_transform(sp.csr_matrix(m2)).toarray(),
          expected,
      )
  
imports: import json
  import os
  import re
  import unittest
  import numpy
  import scipy.sparse
  from numpy.testing import assert_almost_equal, assert_array_equal
  from sklearn.datasets import make_classification
  from sklearn.feature_extraction import FeatureHasher
  from skll.data import FeatureSet, NDJWriter
  from skll.experiments import run_configuration
  from skll.learner import Learner
  from skll.learner.utils import SelectByMinCount
  from skll.utils.testing import config_dir, fill_in_config_paths, output_dir, test_dir, train_dir, unlink
label_desc: Use image node_id 3 for calling the TestPreprocessing obj's underlying member method code with example usage: obj.test_SelectByMinCount() without return types