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
368b9d78
Commit
368b9d78
authored
Jun 13, 2014
by
gradyward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test changes to get them to pass
parent
31d4363d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
30 deletions
+3
-30
ease/tests/test_model_accuracy.py
+3
-30
No files found.
ease/tests/test_model_accuracy.py
View file @
368b9d78
...
...
@@ -121,9 +121,6 @@ class ModelCreator():
def
create_model
(
self
):
if
not
self
.
create_model_generic
:
return
create
.
create
(
self
.
text
,
self
.
scores
,
""
)
else
:
return
create
.
create_generic
(
self
.
text
.
get
(
'numeric_values'
,
[]),
self
.
text
.
get
(
'textual_values'
,
[]),
self
.
scores
)
class
Grader
():
...
...
@@ -133,9 +130,6 @@ class Grader():
def
grade
(
self
,
submission
):
if
isinstance
(
submission
,
basestring
):
return
grade
.
grade
(
self
.
model_data
,
submission
)
else
:
return
grade
.
grade_generic
(
self
.
model_data
,
submission
.
get
(
'numeric_values'
,
[]),
submission
.
get
(
'textual_values'
,
[]))
class
GenericTest
(
object
):
...
...
@@ -173,8 +167,11 @@ class GenericTest(object):
grader
=
Grader
(
results
)
results
=
grader
.
grade
(
self
.
text
[
0
])
if
not
results
[
'success'
]:
raise
Exception
(
results
[
'errors'
])
assert
results
[
'success'
]
==
True
def
scoring_accuracy
(
self
):
random
.
seed
(
1
)
model_creator
=
ModelCreator
(
self
.
scores
,
self
.
text
)
...
...
@@ -185,27 +182,6 @@ class GenericTest(object):
assert
cv_kappa
>=
self
.
expected_kappa_min
assert
cv_mae
<=
self
.
expected_mae_max
def
generic_model_creation_and_grading
(
self
):
log
.
info
(
self
.
scores
)
log
.
info
(
self
.
text
)
score_subset
=
[
random
.
randint
(
0
,
100
)
for
i
in
xrange
(
0
,
min
([
QUICK_TEST_LIMIT
,
len
(
self
.
scores
)]))]
text_subset
=
self
.
text
[:
QUICK_TEST_LIMIT
]
text_subset
=
{
'textual_values'
:
[[
t
]
for
t
in
text_subset
],
'numeric_values'
:
[[
1
]
for
i
in
xrange
(
0
,
len
(
text_subset
))]
}
model_creator
=
ModelCreator
(
score_subset
,
text_subset
)
results
=
model_creator
.
create_model
()
assert
results
[
'success'
]
==
True
grader
=
Grader
(
results
)
test_text
=
{
'textual_values'
:
[
self
.
text
[
0
]],
'numeric_values'
:
[
1
]
}
results
=
grader
.
grade
(
test_text
)
assert
results
[
'success'
]
==
True
class
PolarityTest
(
unittest
.
TestCase
,
GenericTest
):
loader
=
PolarityLoader
...
...
@@ -226,9 +202,6 @@ class PolarityTest(unittest.TestCase, GenericTest):
def
test_scoring_accuracy
(
self
):
self
.
scoring_accuracy
()
def
test_generic_model_creation_and_grading
(
self
):
self
.
generic_model_creation_and_grading
()
class
JSONTest
(
GenericTest
):
loader
=
JSONLoader
...
...
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