Commit 47807926 by VikParuchuri

Merge pull request #3 from MITx/vik/deployment_work

Vik/deployment work
parents 1865c54d 9cd70797
......@@ -219,6 +219,7 @@ class FeatureExtractor(object):
#Iterate through essays and create a feedback dict for each
all_feedback=[]
for m in xrange(0,len(e_set._text)):
#Be very careful about changing these messages!
individual_feedback={'grammar' : "Grammar: Ok.", 'spelling' : "Spelling: Ok.",
'topicality' : "Topicality: Ok.", 'markup_text' : "",
'prompt_overlap' : "Prompt Overlap: Ok.",
......@@ -253,7 +254,7 @@ class FeatureExtractor(object):
if f_row_prop<(self._mean_f_prop/1.5) or len(e_set._text[m])<20:
individual_feedback['topicality']="Topicality: Essay may be off topic."
if(features[m,9]>.5):
if(features[m,9]>.6):
individual_feedback['prompt_overlap']="Prompt Overlap: Too much overlap with prompt."
log.debug(features[m,9])
......
......@@ -64,7 +64,7 @@ def grade(grader_data,grader_config,submission):
if not has_error:
if(len(feedback['prompt_overlap'])>4):
if(len(feedback['prompt_overlap'])>20):
results['score']=0
results['correct']=False
......
......@@ -127,9 +127,14 @@ def extract_features_and_generate_model(essays,additional_array=None):
cv_error_results=get_cv_error(clf2,train_feats,essays._score)
set_score = numpy.asarray(essays._score, dtype=numpy.int)
clf.fit(train_feats, set_score)
try:
set_score = numpy.asarray(essays._score, dtype=numpy.int)
clf.fit(train_feats, set_score)
except ValueError:
log.exception("Not enough classes (0,1,etc) in sample.")
set_score[0]=1
set_score[1]=0
clf.fit(train_feats, set_score)
return f, clf, cv_error_results
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment