-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
5 changed files
with
44 additions
and
12 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
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
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,29 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from autointent.modules import AdaptivePredictor | ||
from autointent.modules.prediction.utils import InvalidNumClassesError, WrongClassificationError | ||
|
||
|
||
def test_multilabel(multilabel_fit_data): | ||
predictor = AdaptivePredictor() | ||
predictor.fit(*multilabel_fit_data) | ||
scores = np.array([[0.2, 0.9, 0], [0.8, 0, 0.6], [0, 0.4, 0.7]]) | ||
predictions = predictor.predict(scores) | ||
desired = np.array([[0, 1, 0], [1, 0, 1], [0, 1, 1]]) | ||
|
||
np.testing.assert_array_equal(predictions, desired) | ||
|
||
|
||
def test_fails_on_wrong_n_classes_predict(multilabel_fit_data): | ||
predictor = AdaptivePredictor() | ||
predictor.fit(*multilabel_fit_data) | ||
scores = np.array([[0.1, 0.9], [0.8, 0.2], [0.3, 0.7]]) | ||
with pytest.raises(InvalidNumClassesError): | ||
predictor.predict(scores) | ||
|
||
|
||
def test_fails_on_wrong_clf_problem(multiclass_fit_data): | ||
predictor = AdaptivePredictor() | ||
with pytest.raises(WrongClassificationError): | ||
predictor.fit(*multiclass_fit_data) |
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