mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Add types to remaining files; activate mypy's disallow_untyped_defs
This commit is contained in:
@@ -10,7 +10,7 @@ from miplearn.classifiers.counting import CountingClassifier
|
||||
E = 0.1
|
||||
|
||||
|
||||
def test_counting():
|
||||
def test_counting() -> None:
|
||||
clf = CountingClassifier()
|
||||
n_features = 25
|
||||
x_train = np.zeros((8, n_features))
|
||||
|
||||
@@ -10,7 +10,7 @@ from sklearn.neighbors import KNeighborsClassifier
|
||||
from miplearn.classifiers.sklearn import ScikitLearnClassifier, ScikitLearnRegressor
|
||||
|
||||
|
||||
def test_constant_prediction():
|
||||
def test_constant_prediction() -> None:
|
||||
x_train = np.array([[0.0, 1.0], [1.0, 0.0]])
|
||||
y_train = np.array([[True, False], [True, False]])
|
||||
clf = ScikitLearnClassifier(KNeighborsClassifier(n_neighbors=1))
|
||||
@@ -22,7 +22,7 @@ def test_constant_prediction():
|
||||
)
|
||||
|
||||
|
||||
def test_regressor():
|
||||
def test_regressor() -> None:
|
||||
x_train = np.array([[0.0, 1.0], [1.0, 4.0], [2.0, 2.0]])
|
||||
y_train = np.array([[1.0], [5.0], [4.0]])
|
||||
x_test = np.array([[4.0, 4.0], [0.0, 0.0]])
|
||||
|
||||
@@ -10,7 +10,7 @@ from miplearn.classifiers import Classifier
|
||||
from miplearn.classifiers.threshold import MinPrecisionThreshold
|
||||
|
||||
|
||||
def test_threshold_dynamic():
|
||||
def test_threshold_dynamic() -> None:
|
||||
clf = Mock(spec=Classifier)
|
||||
clf.predict_proba = Mock(
|
||||
return_value=np.array(
|
||||
|
||||
Reference in New Issue
Block a user