Exemple #1
0
    def test_step_stacking(self):
        lb = Lava(InterceptRegressor(), InterceptRegressor())
        y = np.array([1, 4, 6]).T
        u = np.array([5, 4]).T
        lb.step(y, u)
        lb.step(y, u)

        self.assertEqual((2, 2), lb.u_history.shape,
                         f"the u history has shape {lb.u_history.shape}")
        self.assertEqual((3, 2), lb.y_history.shape,
                         f"the y history has shape {lb.y_history.shape}")
Exemple #2
0
    def test_step_regularized_ARX(self):
        """Can we step with some actual regressor models?"""
        arx_regressor = ARXRegressor(y_lag_max=2, u_lag_max=1)
        intercept_regressor = InterceptRegressor()
        lb = Lava(nominal_model=intercept_regressor,
                  latent_model=arx_regressor)

        ret = lb.step(np.array([3, 3]), np.array([3, 3]))
        self.assertFalse(ret)

        lb.step(np.array([1, 1]), np.array([2, 2]))
        ret = lb.step(np.array([1, 1]), np.array([2, 2]))
        self.assertTrue(ret)
Exemple #3
0
    def test_two_dimensional_series(self):
        """ Is it possible to run 2D series? """
        int1_reg = InterceptRegressor()
        int2_reg = InterceptRegressor()
        lb = Lava(nominal_model=int2_reg, latent_model=int1_reg)

        ret = lb.step([1, 1], [2, 2])
        self.assertTrue(ret)