Exemple #1
0
    def test_with_pandas_df(self):
        x, y = make_classification(random_state=1105)
        df = pd.DataFrame(x)
        df['y'] = y

        m = LogitNet(n_folds=3, random_state=123)
        m = m.fit(df.drop(['y'], axis=1), df.y)
        sanity_check_logistic(m, x)
    def test_with_pandas_df(self):
        x, y = make_classification(random_state=1105)
        df = pd.DataFrame(x)
        df['y'] = y

        m = LogitNet(n_splits=3, random_state=123)
        m = m.fit(df.drop(['y'], axis=1), df.y)
        sanity_check_logistic(m, x)
 def test_n_splits(self):
     x, y = self.binomial[0]
     for n in self.n_splits:
         m = LogitNet(n_splits=n, random_state=46657)
         if n > 0 and n < 3:
             with self.assertRaisesRegexp(ValueError,
                                          "n_splits must be at least 3"):
                 m = m.fit(x, y)
         else:
             m = m.fit(x, y)
             sanity_check_logistic(m, x)
Exemple #4
0
 def test_n_folds(self):
     x, y = self.binomial[0]
     for n in self.n_folds:
         m = LogitNet(n_folds=n, random_state=46657)
         if n > 0 and n < 3:
             with self.assertRaisesRegexp(ValueError,
                                          "n_folds must be at least 3"):
                 m = m.fit(x, y)
         else:
             m = m.fit(x, y)
             sanity_check_logistic(m, x)
    def test_with_defaults(self):
        m = LogitNet(random_state=29341)
        for x, y in itertools.chain(self.binomial, self.multinomial):
            m = m.fit(x, y)
            sanity_check_logistic(m, x)

            # check selection of lambda_best
            assert m.lambda_best_inx_ <= m.lambda_max_inx_

            # check full path predict
            p = m.predict(x, lamb=m.lambda_path_)
            assert p.shape[-1] == m.lambda_path_.size
Exemple #6
0
    def test_with_defaults(self):
        m = LogitNet(random_state=29341)
        for x, y in itertools.chain(self.binomial, self.multinomial):
            m = m.fit(x, y)
            sanity_check_logistic(m, x)

            # check selection of lambda_best
            ok_(m.lambda_best_inx_ <= m.lambda_max_inx_)

            # check full path predict
            p = m.predict(x, lamb=m.lambda_path_)
            eq_(p.shape[-1], m.lambda_path_.size)