MCPcopy Index your code
hub / github.com/clips/pattern / test_feature_selection

Method test_feature_selection

test/test_vector.py:541–554  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

539 print "pattern.vector.Model.reduce()"
540
541 def test_feature_selection(self):
542 # Assert information gain feature selection.
543 v = self.model.feature_selection(top=4, method=vector.IG)
544 self.assertEqual(sorted(v), ["bark", "howl", "meow", "purr"])
545 # Assert Model.filter().
546 v = self.model.filter(v)
547 self.assertTrue("purr" in v.terms)
548 self.assertTrue("meow" in v.terms)
549 self.assertTrue("howl" in v.terms)
550 self.assertTrue("bark" in v.terms)
551 self.assertTrue("cats" not in v.terms)
552 self.assertTrue("dogs" not in v.terms)
553 print "pattern.vector.Model.feature_selection()"
554 print "pattern.vector.Model.filter()"
555
556 def test_information_gain(self):
557 # Assert information gain weights.

Callers

nothing calls this directly

Calls 2

feature_selectionMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected