Esempio n. 1
0
    def _init_model(self, x):
        n_features = x.shape[1]

        self.converged_ = False
        self.n_iter_ = 0
        self._z = np.zeros(n_features)
        # u has one row per each row-block in x
        self._u = ds.zeros((x._n_blocks[0], n_features), (1, x._reg_shape[1]))
Esempio n. 2
0
    def test_full(self):
        """ Tests full functions """
        x = ds.zeros((10, 10), (3, 7), dtype=int)
        x_np = np.zeros((10, 10), dtype=int)
        self.assertTrue(_validate_array(x))
        self.assertTrue(_equal_arrays(x.collect(), x_np))

        x = ds.full((11, 11), (3, 5), 15, dtype=float)
        x_np = np.full((11, 11), 15, dtype=float)
        self.assertTrue(_validate_array(x))
        self.assertTrue(_equal_arrays(x.collect(), x_np))
 def empty_state(self):
     bs = self._hilbert_size // max_par
     self._state = ds.zeros(shape=(1, self._hilbert_size),
                            block_size=(1, bs),
                            dtype=np.complex64)
     return