(self)
Ensure that the table owns its data; copy arrays when necessary.
Ensure that the table owns its data; copy arrays when necessary.
Ensure that the table owns its data ; copy arrays when necessary .
def ensure_copy(self):
        """
        Ensure that the table owns its data; copy arrays when necessary.
        """

        def is_view(x):
            # Sparse matrices don't have views like numpy arrays. Since indexing on
            # them creates copies in constructor we can skip this check here.
            return not sp.issparse(x) and x.base is not None

        if is_view(self._X):
            self._X = self._X.copy()
        if is_view(self._Y):
            self._Y = self._Y.copy()
        if is_view(self._metas):
            self._metas = self._metas.copy()
        if is_view(self._W):
            self._W = self._W.copy()
def ensure_copy ( self ) : def is_view ( x ) : # Sparse matrices don't have views like numpy arrays. Since indexing on # them creates copies in constructor we can skip this check here. return not sp . issparse ( x ) and x . base is not None if is_view ( self . _X ) : self . _X = self . _X . copy ( ) if is_view ( self . _Y ) : self . _Y = self . _Y . copy ( ) if is_view ( self . _metas ) : self . _metas = self . _metas . copy ( ) if is_view ( self . _W ) : self . _W = self . _W . copy ( )