Skip to content
Snippets Groups Projects
Commit 0256d46e authored by nachorequeno's avatar nachorequeno
Browse files

- New function for testing Table.dlearn function in test_Table.py

parent 68795e34
No related branches found
No related tags found
No related merge requests found
......@@ -16,21 +16,30 @@ class TermsTestCase(unittest.TestCase):
# def test_init(self):
def test_klearn(self):
print('A sample of size 5 is used to learn a rectangle (1-term DNF)')
self.T = Table(self.training_sample, cost_function='dist')
# The learning function stops when 'h' reaches k = 1 terms
self.T.klearn(k=1, select='f', print_on=False, print_latex=False)
# self.assertEqual(self.T.terms, ['1100**'])
self.assertEqual(self.T.terms, ['11*0**'])
def test_elearn(self):
print('A sample of size 5 is used to learn a rectangle (1-term DNF)')
self.T = Table(self.training_sample, cost_function='dist')
# The learning function stops when 'h' the number of falses positives using the testing_sample is below an error 'e'
self.T.elearn(self.testing_sample, e=0.1)
self.T.elearn(testing_sample=self.testing_sample, e=0.1, select='f', print_on=False, print_latex=False)
# self.assertEqual(self.T.terms, ['11001*'])
self.assertEqual(self.T.terms, ['11*0**'])
def test_klearn(self):
def test_dlearn(self):
print('A sample of size 5 is used to learn a rectangle (1-term DNF)')
self.T = Table(self.training_sample, cost_function='dist')
# The learning function stops when 'h' reaches k = 1 terms
self.T.klearn(1)
self.T.dlearn(threshold=float('inf'), select='f', print_on=False, print_latex=False)
# self.assertEqual(self.T.terms, ['1100**'])
self.assertEqual(self.T.terms, ['11*0**'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment