Commit fd8d2888 by Vik Paruchuri

Hopefully make model creator more robust

parent 1865c54d
...@@ -127,9 +127,14 @@ def extract_features_and_generate_model(essays,additional_array=None): ...@@ -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) cv_error_results=get_cv_error(clf2,train_feats,essays._score)
set_score = numpy.asarray(essays._score, dtype=numpy.int) try:
clf.fit(train_feats, set_score) 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 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