Skip to content

Commit ae4f1cf

Browse files
ayushjain19norvig
authored andcommitted
Added tests for information_content (aimacode#753)
* Added tests for information_content Added some tests for information_content function from learning.py * Added test for information_content
1 parent 06af67e commit ae4f1cf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_learning.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ def test_decision_tree_learner():
165165
assert dTL([7.5, 4, 6, 2]) == "virginica"
166166

167167

168+
def test_information_content():
169+
assert information_content([]) == 0
170+
assert information_content([4]) == 0
171+
assert information_content([5, 4, 0, 2, 5, 0]) > 1.9
172+
assert information_content([5, 4, 0, 2, 5, 0]) < 2
173+
assert information_content([1.5, 2.5]) > 0.9
174+
assert information_content([1.5, 2.5]) < 1.0
175+
176+
168177
def test_random_forest():
169178
iris = DataSet(name="iris")
170179
rF = RandomForest(iris)

0 commit comments

Comments
 (0)