def test_fit_with_ties(whas500_with_ties):
        x, y = whas500_with_ties

        nrsvm = NaiveSurvivalSVM(loss='squared_hinge', dual=False, tol=1e-8, max_iter=1000, random_state=0)
        nrsvm.fit(x, y)

        assert nrsvm.coef_.shape == (1, 14)

        cindex = nrsvm.score(x, y)
        assert round(abs(cindex - 0.7760582309811175), 7) == 0
Ejemplo n.º 2
0
    def test_fit_with_ties(self):
        x, y = self.get_data_with_ties()

        nrsvm = NaiveSurvivalSVM(loss='squared_hinge',
                                 dual=False,
                                 tol=1e-8,
                                 max_iter=1000,
                                 random_state=0)
        nrsvm.fit(x, y)

        self.assertTupleEqual(nrsvm.coef_.shape, (1, 14))

        cindex = nrsvm.score(x, y)
        self.assertAlmostEqual(cindex, 0.7760582309811175)