ValueError: BinomialDeviance requires 2 classes.
natea opened this issue · 2 comments
When I try to run the tests, I get the following error on the machine-learning package. Which branch of machine-learning should I be using? right now, I'm using the master branch.
(edx)vagrant@precise32:/opt/wwc/ml-service-api$ python manage.py test --settings=ml_service_api.test_settings --pythonpath=.
nosetests --verbosity 1 --with-xunit --with-coverage --cover-html-dir cover --cover-package freeform_data --cover-package ml_grading
Creating test database for alias 'default'...
........................2013-04-24 17:31:33,772 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:95 - Currently on location 0 in problem 1
2013-04-24 17:31:33,775 INFO 16329 [ml_grading.ml_model_creation] ml_model_creation.py:109 - Starting to create a model because none exists or it is time to retrain.
2013-04-24 17:31:39,572 ERROR 16329 [root] model_creator.py:106 - Not enough classes (0,1,etc) in each cross validation fold.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 98, in get_cv_error
cv_preds=util_functions.gen_cv_preds(clf,feats,scores)
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/util_functions.py", line 292, in gen_cv_preds
sim_fit = clf.fit(arr[loop_inds], set_score[loop_inds])
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in __init__
self.__class__.__name__)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:39,577 ERROR 16329 [root] model_creator.py:185 - Not enough classes (0,1,etc) in sample.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 183, in extract_features_and_generate_model
clf.fit(train_feats, set_score)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in __init__
self.__class__.__name__)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:40,454 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:191 - Location: ml_models_api/1_0_20130424223133 Creation Status: True Errors: []
2013-04-24 17:31:40,455 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:95 - Currently on location 1 in problem 1
2013-04-24 17:31:40,458 INFO 16329 [ml_grading.ml_model_creation] ml_model_creation.py:109 - Starting to create a model because none exists or it is time to retrain.
2013-04-24 17:31:42,750 ERROR 16329 [root] model_creator.py:106 - Not enough classes (0,1,etc) in each cross validation fold.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 98, in get_cv_error
cv_preds=util_functions.gen_cv_preds(clf,feats,scores)
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/util_functions.py", line 292, in gen_cv_preds
sim_fit = clf.fit(arr[loop_inds], set_score[loop_inds])
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in __init__
self.__class__.__name__)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:42,754 ERROR 16329 [root] model_creator.py:185 - Not enough classes (0,1,etc) in sample.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 183, in extract_features_and_generate_model
clf.fit(train_feats, set_score)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in __init__
self.__class__.__name__)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:43,885 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:191 - Location: ml_models_api/1_1_20130424223140 Creation Status: True Errors: []
...............2013-04-24 17:31:54,908 DEBUG 16329 [freeform_data.tests] tests.py:350 - {u'message': u'Logged in.', u'success': True}
...
Name Stmts Miss Cover Missing
-----------------------------------------------------------------
freeform_data 0 0 100%
freeform_data.api 261 12 95% 81-82, 182-183, 257, 280, 303, 306, 329, 352, 381, 407
freeform_data.django_validators 42 13 69% 22, 32-33, 46-47, 51-52, 59-60, 65-66, 72-73
freeform_data.fields 5 0 100%
freeform_data.forms 39 0 100%
freeform_data.guardian_auth 95 36 62% 26, 30, 39, 53, 62-72, 79, 88-100, 107, 115, 118-130, 138, 146
freeform_data.management 1 0 100%
freeform_data.management.commands 1 0 100%
freeform_data.tastypie_validators 48 5 90% 28, 58, 71, 83-84
freeform_data.throttle 45 4 91% 48, 97-98, 110
freeform_data.urls 17 0 100%
freeform_data.views 37 5 86% 15, 19, 27, 38, 51
ml_grading 0 0 100%
ml_grading.ml_grader 99 46 54% 30-31, 57-61, 75, 80-90, 95-97, 129, 133-154, 162-172
ml_grading.ml_grading_util 57 14 75% 86, 98-110, 120-121
ml_grading.ml_model_creation 124 40 68% 22-23, 53-54, 59-62, 70-72, 80-81, 86-88, 103, 115-122, 141-144, 164-168, 185-186, 204-207, 213, 216-217
-----------------------------------------------------------------
TOTAL 871 175 80%
----------------------------------------------------------------------
Ran 42 tests in 40.344s
OK
Destroying test database for alias 'default'...
That error is fine. It is an informational error from the machine learning
package. Tests still pass.
On Wed, Apr 24, 2013 at 6:34 PM, Nate Aune notifications@github.com wrote:
When I try to run the tests, I get the following error on the
machine-learning package. Which branch of machine-learning should I be
using? right now, I'm using the master branch.(edx)vagrant@precise32:/opt/wwc/ml-service-api$ python manage.py test --settings=ml_service_api.test_settings --pythonpath=.
nosetests --verbosity 1 --with-xunit --with-coverage --cover-html-dir cover --cover-package freeform_data --cover-package ml_grading
Creating test database for alias 'default'...
........................2013-04-24 17:31:33,772 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:95 - Currently on location 0 in problem 1
2013-04-24 17:31:33,775 INFO 16329 [ml_grading.ml_model_creation] ml_model_creation.py:109 - Starting to create a model because none exists or it is time to retrain.
2013-04-24 17:31:39,572 ERROR 16329 [root] model_creator.py:106 - Not enough classes (0,1,etc) in each cross validation fold.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 98, in get_cv_error
cv_preds=util_functions.gen_cv_preds(clf,feats,scores)
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/util_functions.py", line 292, in gen_cv_preds
sim_fit = clf.fit(arr[loop_inds], set_score[loop_inds])
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in init
self.class.name)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:39,577 ERROR 16329 [root] model_creator.py:185 - Not enough classes (0,1,etc) in sample.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 183, in extract_features_and_generate_model
clf.fit(train_feats, set_score)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in init
self.class.name)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:40,454 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:191 - Location: ml_models_api/1_0_20130424223133 Creation Status: True Errors: []
2013-04-24 17:31:40,455 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:95 - Currently on location 1 in problem 1
2013-04-24 17:31:40,458 INFO 16329 [ml_grading.ml_model_creation] ml_model_creation.py:109 - Starting to create a model because none exists or it is time to retrain.
2013-04-24 17:31:42,750 ERROR 16329 [root] model_creator.py:106 - Not enough classes (0,1,etc) in each cross validation fold.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 98, in get_cv_error
cv_preds=util_functions.gen_cv_preds(clf,feats,scores)
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/util_functions.py", line 292, in gen_cv_preds
sim_fit = clf.fit(arr[loop_inds], set_score[loop_inds])
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in init
self.class.name)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:42,754 ERROR 16329 [root] model_creator.py:185 - Not enough classes (0,1,etc) in sample.
Traceback (most recent call last):
File "/opt/edx/local/lib/python2.7/site-packages/machine_learning-0.1-py2.7.egg/machine_learning/model_creator.py", line 183, in extract_features_and_generate_model
clf.fit(train_feats, set_score)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 790, in fit
return super(GradientBoostingClassifier, self).fit(X, y)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 535, in fit
loss = loss_class(self.n_classes_)
File "/opt/edx/local/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py", line 326, in init
self.class.name)
ValueError: BinomialDeviance requires 2 classes.
2013-04-24 17:31:43,885 DEBUG 16329 [ml_grading.ml_model_creation] ml_model_creation.py:191 - Location: ml_models_api/1_1_20130424223140 Creation Status: True Errors: []
...............2013-04-24 17:31:54,908 DEBUG 16329 [freeform_data.tests] tests.py:350 - {u'message': u'Logged in.', u'success': True}
...Name Stmts Miss Cover Missing
freeform_data 0 0 100%
freeform_data.api 261 12 95% 81-82, 182-183, 257, 280, 303, 306, 329, 352, 381, 407
freeform_data.django_validators 42 13 69% 22, 32-33, 46-47, 51-52, 59-60, 65-66, 72-73
freeform_data.fields 5 0 100%
freeform_data.forms 39 0 100%
freeform_data.guardian_auth 95 36 62% 26, 30, 39, 53, 62-72, 79, 88-100, 107, 115, 118-130, 138, 146
freeform_data.management 1 0 100%
freeform_data.management.commands 1 0 100%
freeform_data.tastypie_validators 48 5 90% 28, 58, 71, 83-84
freeform_data.throttle 45 4 91% 48, 97-98, 110
freeform_data.urls 17 0 100%
freeform_data.views 37 5 86% 15, 19, 27, 38, 51
ml_grading 0 0 100%
ml_grading.ml_grader 99 46 54% 30-31, 57-61, 75, 80-90, 95-97, 129, 133-154, 162-172
ml_grading.ml_grading_util 57 14 75% 86, 98-110, 120-121ml_grading.ml_model_creation 124 40 68% 22-23, 53-54, 59-62, 70-72, 80-81, 86-88, 103, 115-122, 141-144, 164-168, 185-186, 204-207, 213, 216-217
TOTAL 871 175 80%
Ran 42 tests in 40.344s
OK
Destroying test database for alias 'default'...—
Reply to this email directly or view it on GitHubhttps://github.com//issues/19
.
Ok, thanks.