Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boolean
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
verimag
tempo
boolean
Commits
0256d46e
Commit
0256d46e
authored
6 years ago
by
nachorequeno
Browse files
Options
Downloads
Patches
Plain Diff
- New function for testing Table.dlearn function in test_Table.py
parent
68795e34
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/test_Table.py
+12
-3
12 additions, 3 deletions
Tests/test_Table.py
with
12 additions
and
3 deletions
Tests/test_Table.py
+
12
−
3
View file @
0256d46e
...
...
@@ -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_
k
learn
(
self
):
def
test_
d
learn
(
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
.
k
learn
(
1
)
self
.
T
.
d
learn
(
threshold
=
float
(
'
inf
'
),
select
=
'
f
'
,
print_on
=
False
,
print_latex
=
False
)
# self.assertEqual(self.T.terms, ['1100**'])
self
.
assertEqual
(
self
.
T
.
terms
,
[
'
11*0**
'
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment