splearn/preprocessing/data.py
def transform(self, Z):
        """Perform standardization by centering and scaling
        Parameters
        ----------
        Z : DictRDD containing (X, y) pairs
            X - Training vector
            y - Target labels
        Returns
        -------
        C : DictRDD containing (X, y) pairs
            X - Training vector standardized
            y - Target labels
        """
        X = Z[:, 'X'] if isinstance(Z, DictRDD) else Z
        check_rdd(X, (np.ndarray, sp.spmatrix))

        if check_rdd_dtype(X, (sp.spmatrix)):
            if self.with_mean:
                raise ValueError(
                    "Cannot center sparse matrices: pass `with_mean=False` "
                    "instead. See docstring for motivation and alternatives.")
            if self.scale_ is not None:
                def mapper(X):
                    inplace_column_scale(X, 1 / self.scale_)
                    return X
        else:
            if self.with_mean:
                if self.with_std:
                    def mapper(X):
                        X -= self.mean_
                        X /= self.scale_
                        return X
                else:
                    def mapper(X):
                        X -= self.mean_
                        return X
            else:
                if self.with_std:
                    def mapper(X):
                        X /= self.scale_
                        return X
                else:
                    raise ValueError("Need with_std or with_mean ")
        return Z.transform(mapper, column="X")
def transform(self, Z):
        """Perform standardization by centering and scaling
        Parameters
        ----------
        Z : DictRDD containing (X, y) pairs
            X - Training vector
            y - Target labels
        Returns
        -------
        C : DictRDD containing (X, y) pairs
            X - Training vector standardized
            y - Target labels
        """
        X = Z[:, 'X'] if isinstance(Z, DictRDD) else Z
        check_rdd(X, (np.ndarray, sp.spmatrix))

        if check_rdd_dtype(X, (sp.spmatrix)):
            if self.with_mean:
                raise ValueError(
                    "Cannot center sparse matrices: pass `with_mean=False` "
                    "instead. See docstring for motivation and alternatives.")
            if self.scale_ is not None:
                def mapper(X):
                    inplace_column_scale(X, 1 / self.scale_)
                    return X
        else:
            if self.with_mean:
                if self.with_std:
                    def mapper(X):
                        X -= self.mean_
                        X /= self.scale_
                        return X
                else:
                    def mapper(X):
                        X -= self.mean_
                        return X
            else:
                if self.with_std:
                    def mapper(X):
                        X /= self.scale_
                        return X
                else:
                    raise ValueError("Need with_std or with_mean ")
        return Z.transform(mapper, column="X")
def transform ( self , Z ) : X = Z [ : , 'X' ] if isinstance ( Z , DictRDD ) else Z check_rdd ( X , ( np . ndarray , sp . spmatrix ) ) if check_rdd_dtype ( X , ( sp . spmatrix ) ) : if self . with_mean : raise ValueError ( "Cannot center sparse matrices: pass `with_mean=False` " "instead. See docstring for motivation and alternatives." ) if self . scale_ is not None : def mapper ( X ) : inplace_column_scale ( X , 1 / self . scale_ ) return X else : if self . with_mean : if self . with_std : def mapper ( X ) : X -= self . mean_ X /= self . scale_ return X else : def mapper ( X ) : X -= self . mean_ return X else : if self . with_std : def mapper ( X ) : X /= self . scale_ return X else : raise ValueError ( "Need with_std or with_mean " ) return Z . transform ( mapper , column = "X" )
Perform standardization by centering and scaling
        Parameters
        ----------
        Z : DictRDD containing (X, y) pairs
            X - Training vector
            y - Target labels
        Returns
        -------
        C : DictRDD containing (X, y) pairs
            X - Training vector standardized
            y - Target labels
Perform standardization by centering and scaling Parameters ---------- Z : DictRDD containing ( X y ) pairs X - Training vector y - Target labels Returns ------- C : DictRDD containing ( X y ) pairs X - Training vector standardized y - Target labels