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
e86966aa
Commit
e86966aa
authored
Dec 06, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Abstract out grader model files from ml repo.
parent
f48373e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
14 deletions
+6
-14
create.py
+5
-8
grade.py
+1
-6
No files found.
create.py
View file @
e86966aa
...
...
@@ -17,7 +17,8 @@ from statsd import statsd
@statsd.timed
(
'open_ended_assessment.machine_learning.creator.time'
)
def
create
(
text
,
score
,
prompt_string
,
model_path
):
results
=
{
'errors'
:
[],
'success'
:
False
,
'cv_kappa'
:
0
,
'cv_mean_absolute_error'
:
0
}
results
=
{
'errors'
:
[],
'success'
:
False
,
'cv_kappa'
:
0
,
'cv_mean_absolute_error'
:
0
,
'feature_ext'
:
""
,
'classifier'
:
""
}
try
:
e_set
=
model_creator
.
create_essay_set
(
text
,
score
,
prompt_string
)
except
:
...
...
@@ -28,15 +29,11 @@ def create(text,score,prompt_string,model_path):
feature_ext
,
classifier
,
cv_error_results
=
model_creator
.
extract_features_and_generate_model
(
e_set
)
results
[
'cv_kappa'
]
=
cv_error_results
[
'kappa'
]
results
[
'cv_mean_absolute_error'
]
=
cv_error_results
[
'mae'
]
except
:
msg
=
"feature extraction and model creation failed."
results
[
'errors'
]
.
append
(
msg
)
log
.
exception
(
msg
)
try
:
model_creator
.
dump_model_to_file
(
prompt_string
,
feature_ext
,
classifier
,
text
,
score
,
model_path
)
results
[
'feature_ext'
]
=
feature_ext
results
[
'classifier'
]
=
classifier
results
[
'success'
]
=
True
except
:
msg
=
"
could not write model to: {0}"
.
format
(
model_path
)
msg
=
"
feature extraction and model creation failed."
results
[
'errors'
]
.
append
(
msg
)
log
.
exception
(
msg
)
...
...
grade.py
View file @
e86966aa
...
...
@@ -27,7 +27,7 @@ log = logging.getLogger(__name__)
TEMPORARY_WANTS_CONFIG
=
True
@statsd.timed
(
'open_ended_assessment.machine_learning.grader.time'
)
def
grade
(
grader_
path
,
grader_config
,
submission
,
sandbox
=
None
):
def
grade
(
grader_
data
,
grader_config
,
submission
,
sandbox
=
None
):
results
=
{
'errors'
:
[],
'tests'
:
[],
'score'
:
0
,
'feedback'
:
""
,
'success'
:
False
,
'confidence'
:
0
}
...
...
@@ -35,11 +35,6 @@ def grade(grader_path,grader_config,submission,sandbox=None):
#Try to find and load the model file
try
:
grader_data
=
pickle
.
load
(
file
(
grader_path
,
"r"
))
except
:
results
[
'errors'
]
.
append
(
"Could not find a valid model file."
)
has_error
=
True
grader_set
=
EssaySet
(
type
=
"test"
)
#Try to add essays to essay set object
...
...
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