FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added tests for information_content by ayushjain19 · Pull Request #753 · aimacode/aima-python · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 9 additions & 0 deletions tests/test_learning.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ def test_decision_tree_learner():
assert dTL([7.5, 4, 6, 2]) == "virginica"


def test_information_content():
assert information_content([]) == 0
assert information_content([4]) == 0
assert information_content([5, 4, 0, 2, 5, 0]) > 1.9
assert information_content([5, 4, 0, 2, 5, 0]) < 2
assert information_content([1.5, 2.5]) > 0.9

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Better as
assert 0.9 < information_content([1.5, 2.5]) < 1.0

assert information_content([1.5, 2.5]) < 1.0


def test_random_forest():
iris = DataSet(name="iris")
rF = RandomForest(iris)
Expand Down

Back | FazBrowse Home | New Git URL