forked from automl/auto-sklearn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca0973d
commit fb01eff
Showing
4 changed files
with
189 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
test/test_pipeline/components/classification/test_xgradient_boosting.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import unittest | ||
|
||
from autosklearn.pipeline.components.classification.xgradient_boosting import \ | ||
XGradientBoostingClassifier | ||
from autosklearn.pipeline.util import _test_classifier,\ | ||
_test_classifier_predict_proba | ||
|
||
import sklearn.metrics | ||
import sklearn.ensemble | ||
import numpy as np | ||
|
||
|
||
class XGradientBoostingComponentTest(unittest.TestCase): | ||
def test_default_configuration(self): | ||
for i in range(10): | ||
predictions, targets = \ | ||
_test_classifier(XGradientBoostingClassifier) | ||
self.assertAlmostEqual(0.92, | ||
sklearn.metrics.accuracy_score(predictions, targets)) | ||
|
||
def test_default_configuration_binary(self): | ||
for i in range(10): | ||
predictions, targets = _test_classifier( | ||
XGradientBoostingClassifier, make_binary=True) | ||
self.assertAlmostEqual(1.0, | ||
sklearn.metrics.accuracy_score(predictions, | ||
targets)) | ||
|
||
def test_target_algorithm_multioutput_multiclass_support(self): | ||
cls = sklearn.ensemble.GradientBoostingClassifier() | ||
X = np.random.random((10, 10)) | ||
y = np.random.randint(0, 1, size=(10, 10)) | ||
self.assertRaisesRegexp(ValueError, 'bad input shape \(10, 10\)', | ||
cls.fit, X, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters