コード例 #1
0
 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))
コード例 #2
0
ファイル: reorder.py プロジェクト: ckingdev/sparseutil
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)