Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ease
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ease
Commits
7dc8236f
Commit
7dc8236f
authored
May 29, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish tests a bit, add in a test script
parent
0536be97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
ease/tests/test_model_accuracy.py
+15
-7
run_tests.sh
+2
-0
No files found.
ease/tests/test_model_accuracy.py
View file @
7dc8236f
...
...
@@ -10,7 +10,7 @@ ROOT_PATH = os.path.abspath(__file__)
TEST_PATH
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ROOT_PATH
,
".."
))
CHARACTER_LIMIT
=
1000
TRAINING_LIMIT
=
1
0
TRAINING_LIMIT
=
4
0
QUICK_TEST_LIMIT
=
5
class
DataLoader
():
...
...
@@ -80,7 +80,8 @@ class Grader():
class
GenericTest
(
object
):
loader
=
DataLoader
data_path
=
""
expected_accuracy
=
0
expected_kappa_min
=
0
expected_mae_max
=
0
def
generic_setup
(
self
):
data_loader
=
self
.
loader
(
os
.
path
.
join
(
TEST_PATH
,
self
.
data_path
))
...
...
@@ -104,22 +105,29 @@ class GenericTest(object):
text_subset
=
self
.
text
[:
QUICK_TEST_LIMIT
]
model_creator
=
ModelCreator
(
score_subset
,
text_subset
)
results
=
model_creator
.
create_model
()
self
.
assert
Equal
(
results
[
'success'
],
True
)
self
.
assert
True
(
results
[
'success'
]
)
grader
=
Grader
(
results
)
grader
.
grade
(
self
.
text
[
0
])
self
.
assert
Equal
(
results
[
'success'
],
True
)
self
.
assert
True
(
results
[
'success'
]
)
def
test_scoring_accuracy
(
self
):
model_creator
=
ModelCreator
(
self
.
scores
,
self
.
text
)
results
=
model_creator
.
create_model
()
log
.
info
(
results
[
'cv_kappa'
])
log
.
info
(
results
[
'cv_mean_absolute_error'
])
raise
self
.
assertTrue
(
results
[
'success'
])
cv_kappa
=
results
[
'cv_kappa'
]
cv_mae
=
results
[
'cv_mean_absolute_error'
]
self
.
assertGreaterEqual
(
cv_kappa
,
self
.
expected_kappa_min
)
self
.
assertLessEqual
(
cv_mae
,
self
.
expected_mae_max
)
class
PolarityTest
(
unittest
.
TestCase
,
GenericTest
):
loader
=
PolarityLoader
data_path
=
"data/polarity"
#These will increase if we allow more data in.
#I am setting the amount of data low to allow tests to finish quickly (40 training essays, 1000 character max for each)
expected_kappa_min
=
.
26
expected_mae_max
=
.
15
def
setUp
(
self
):
self
.
generic_setup
()
run_tests.sh
0 → 100644
View file @
7dc8236f
nosetests
--with-coverage
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment