예제 #1
0
 def test_implicit_constant(self):
     x = self.rng.standard_normal((1000, 2))
     assert not implicit_constant(x)
     x[:, 0] = 1.0
     assert implicit_constant(x)
     x = self.rng.standard_normal((1000, 3))
     x[:, 0] = x[:, 0] > 0
     x[:, 1] = 1 - x[:, 0]
     assert implicit_constant(x)
예제 #2
0
파일: test_array.py 프로젝트: lbrito1/arch
 def test_implicit_constant(self):
     x = np.random.standard_normal((1000, 2))
     assert_true(not implicit_constant(x))
     x[:, 0] = 1.0
     assert_true(implicit_constant(x))
     x = np.random.standard_normal((1000, 3))
     x[:, 0] = x[:, 0] > 0
     x[:, 1] = 1 - x[:, 0]
     assert_true(implicit_constant(x))
예제 #3
0
파일: test_array.py 프로젝트: bashtage/arch
 def test_implicit_constant(self):
     x = self.rng.standard_normal((1000, 2))
     assert not implicit_constant(x)
     x[:, 0] = 1.0
     assert implicit_constant(x)
     x = self.rng.standard_normal((1000, 3))
     x[:, 0] = x[:, 0] > 0
     x[:, 1] = 1 - x[:, 0]
     assert implicit_constant(x)
예제 #4
0
    def _r2(self, params: NDArray) -> float:
        y = self._fit_y
        x = self._fit_regressors
        constant = False
        if x is not None and x.shape[1] > 0:
            constant = self.constant or implicit_constant(x)
        e = self.resids(params)
        if constant:
            y = y - np.mean(y)

        return 1.0 - e.T.dot(e) / y.dot(y)
예제 #5
0
파일: mean.py 프로젝트: esvhd/arch
    def _r2(self, params):
        y = self._fit_y
        x = self._fit_regressors
        constant = False
        if x is not None and x.shape[1] > 0:
            constant = self.constant or implicit_constant(x)
        e = self.resids(params)
        if constant:
            y = y - np.mean(y)

        return 1.0 - e.T.dot(e) / y.dot(y)