Esempio n. 1
0
    def test_value_predict_type_binary(self, y_type):
        clf = DAGClassifier(alpha=0.1)
        X, y = (
            pd.DataFrame(np.random.normal(size=(100, 2))),
            pd.Series(np.zeros(shape=(100, ), dtype=y_type)),
        )
        y[X[0] < 0] = y_type(1)
        clf.fit(X, y)

        y_pred = clf.predict(X)
        assert isinstance(y_pred[0], y_type)
        y_pred_proba = clf.predict_proba(X)
        assert isinstance(y_pred_proba[0, 0], np.float64)
        assert len(y_pred_proba.shape) == 2
Esempio n. 2
0
 def test_glm(self, target_dist_type, y):
     clf = DAGClassifier(target_dist_type=target_dist_type)
     X = np.random.normal(size=(100, 2))
     clf.fit(X, y)
     clf.predict(X)