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
152e23d6
Commit
152e23d6
authored
Nov 07, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change feedback generation, and change off topic indicator
parent
d718322b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
feature_extractor.py
+5
-2
grade.py
+4
-2
No files found.
feature_extractor.py
View file @
152e23d6
...
...
@@ -12,6 +12,7 @@ import os
from
itertools
import
chain
import
copy
import
operator
import
logging
base_path
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
base_path
)
...
...
@@ -21,6 +22,8 @@ import util_functions
if
not
base_path
.
endswith
(
"/"
):
base_path
=
base_path
+
"/"
log
=
logging
.
getLogger
(
__name__
)
class
FeatureExtractor
(
object
):
def
__init__
(
self
):
...
...
@@ -46,7 +49,7 @@ class FeatureExtractor(object):
self
.
_grammar_errors_per_character
=
1
-
(
sum
(
self
.
_get_grammar_errors
(
e_set
.
_pos
,
e_set
.
_text
,
e_set
.
_tokens
)[
0
])
/
float
(
sum
([
len
(
t
)
for
t
in
e_set
.
_text
])))
bag_feats
=
self
.
gen_bag_feats
(
e_set
)
f_row_sum
=
numpy
.
sum
(
bag_feats
[:,:])
/
bag_feats
.
shape
[
0
]
f_row_sum
=
numpy
.
sum
(
bag_feats
[:,:])
self
.
_mean_f_prop
=
f_row_sum
/
float
(
sum
([
len
(
t
)
for
t
in
e_set
.
_text
]))
ret
=
"ok"
else
:
...
...
@@ -224,7 +227,7 @@ class FeatureExtractor(object):
if
features
is
not
None
:
f_row_sum
=
numpy
.
sum
(
features
[
m
,
12
:])
f_row_prop
=
f_row_sum
/
len
(
e_set
.
_text
[
m
])
if
f_row_prop
<
(
self
.
_mean_f_prop
)
:
if
f_row_prop
<
(
self
.
_mean_f_prop
/
1.5
)
or
len
(
e_set
.
_text
[
m
])
<
20
:
individual_feedback
[
'topicality'
]
=
"Essay may be off topic."
markup_string
=
" "
.
join
(
markup_tokens
)
individual_feedback
[
'markup_text'
]
=
markup_string
...
...
grade.py
View file @
152e23d6
...
...
@@ -74,7 +74,8 @@ error_template = u"""
def
grade
(
grader_path
,
grader_config
,
submission
,
sandbox
=
None
):
if
not
grader_path
.
endswith
(
".p"
):
model_path
+=
".p"
grader_path
+=
".p"
log
.
debug
(
"Grader path: {0}
\n
Submission: {1}"
.
format
(
grader_path
,
submission
))
results
=
{
'errors'
:
[],
'tests'
:
[],
'correct'
:
False
,
'score'
:
0
,
'feedback'
:
""
}
...
...
@@ -100,7 +101,7 @@ def grade(grader_path,grader_config,submission,sandbox=None):
#Try to extract features from submission and assign score via the model
try
:
grader_feats
=
grader_data
[
'extractor'
]
.
gen_feats
(
grader_set
)
feedback
=
grader_data
[
'extractor'
]
.
gen_feedback
(
grader_set
)[
0
]
feedback
=
grader_data
[
'extractor'
]
.
gen_feedback
(
grader_set
,
grader_feats
)[
0
]
results
[
'score'
]
=
int
(
grader_data
[
'model'
]
.
predict
(
grader_feats
)[
0
])
except
:
results
[
'errors'
]
.
append
(
"Could not extract features and score essay."
)
...
...
@@ -130,4 +131,5 @@ def grade(grader_path,grader_config,submission,sandbox=None):
return
results
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