def __add__ ( self , other ) : assert self . matrix . shape [ 1 ] == other . matrix . shape [ 1 ] return LabeledMatrix ( np . concatenate ( [ self . matrix , other . matrix ] , axis = 0 ) , self . labels )
add two matrix with same shape expect one dim python
If the number of columns matches we can concatenate two LabeldMatrices with the + operator .
def __add__(self,other):
        """
            If the number of columns matches, we can concatenate two LabeldMatrices
            with the + operator.
        """
        assert self.matrix.shape[1] == other.matrix.shape[1]
        return LabeledMatrix(np.concatenate([self.matrix,other.matrix],axis=0),self.labels)