def combine(self, m1: csr_matrix, m2: csr_matrix) -> csr_matrix:
     """
     Combines two vectorized matrices to one complying to current vocabulary
     """
     m2.resize(m2.shape[0], len(self.vocabulary))
     m1.resize(m1.shape[0], len(self.vocabulary))
     return sparse.vstack((m1, m2))
Exemplo n.º 2
0
def invert_reorder_trim(X: sparse.csr_matrix, p_row: np.ndarray,
                        p_col: np.ndarray) -> sparse.csr_matrix:
    X.resize(p_row.shape[0], p_col.shape[0])
    return _apply_perm(X, p_row=p_row, p_col=p_col)