Пример #1
0
    def test_pos_class(self):
        X = np.array([0.50, 0.75, 1.00])
        y = np.array([0, 1, 2])
        X = X[:, np.newaxis]

        with self.assertRaises(ValueError):
            _logistic_regression_path(X,
                                      y,
                                      epsilon=1,
                                      data_norm=1.0,
                                      Cs=[1e5],
                                      pos_class=None)
Пример #2
0
    def test_coef(self):
        _logistic_regression_path(self.X,
                                  self.y,
                                  epsilon=1,
                                  data_norm=1.0,
                                  Cs=[1e5],
                                  coef=np.ones(2))

        with self.assertRaises(ValueError):
            _logistic_regression_path(self.X,
                                      self.y,
                                      epsilon=1,
                                      data_norm=1.0,
                                      Cs=[1e5],
                                      coef=np.ones(3))
    def test_with_dataset(self):
        output = _logistic_regression_path(self.X,
                                           self.y,
                                           epsilon=1,
                                           data_norm=1,
                                           Cs=[1e5])

        self.assertIsInstance(output, tuple)
    def test_Cs(self):
        coefs, Cs, n_iter = _logistic_regression_path(self.X,
                                                      self.y,
                                                      epsilon=1,
                                                      data_norm=1,
                                                      Cs=3)

        self.assertEqual(len(coefs), 3)
        self.assertEqual(len(Cs), 3)
        self.assertEqual(len(n_iter), 3)
    def test_with_dataset(self):
        output = _logistic_regression_path(self.X, self.y, Cs=[1e5])

        self.assertTrue(isinstance(output, tuple))
 def test_no_norm(self):
     with self.assertRaises(TypeError):
         _logistic_regression_path(self.X, self.y, Cs=[1e5], epsilon=1)