packages/vaex-ml/vaex/ml/transformations.py
def transform(self, df, n_components=None):
        '''Apply the PCA transformation to the DataFrame.

        :param df: A vaex DataFrame.
        :param n_components: The number of PCA components to retain.

        :return copy: A shallow copy of the DataFrame that includes the PCA components.
        :rtype: DataFrame
        '''
        n_components = n_components or self.n_components
        copy = df.copy()
        name_prefix_offset = 0
        eigen_vectors = np.array(self.eigen_vectors_)
        while self.prefix + str(name_prefix_offset) in copy.get_column_names(virtual=True, strings=True):
            name_prefix_offset += 1

        expressions = [copy[feature]-mean for feature, mean in zip(self.features, self.means_)]
        for i in range(n_components):
            v = eigen_vectors[:, i]
            expr = dot_product(expressions, v)
            name = self.prefix + str(i + name_prefix_offset)
            copy[name] = expr
        return copy
Apply the PCA transformation to the DataFrame.

        :param df: A vaex DataFrame.
        :param n_components: The number of PCA components to retain.

        :return copy: A shallow copy of the DataFrame that includes the PCA components.
        :rtype: DataFrame
        
Apply the PCA transformation to the DataFrame.
Apply the PCA transformation to the DataFrame .
def transform(self, df, n_components=None):
        n_components = n_components or self.n_components
        copy = df.copy()
        name_prefix_offset = 0
        eigen_vectors = np.array(self.eigen_vectors_)
        while self.prefix + str(name_prefix_offset) in copy.get_column_names(virtual=True, strings=True):
            name_prefix_offset += 1
        expressions = [copy[feature]-mean for feature, mean in zip(self.features, self.means_)]
        for i in range(n_components):
            v = eigen_vectors[:, i]
            expr = dot_product(expressions, v)
            name = self.prefix + str(i + name_prefix_offset)
            copy[name] = expr
        return copy
def transform ( self , df , n_components = None ) : n_components = n_components or self . n_components copy = df . copy ( ) name_prefix_offset = 0 eigen_vectors = np . array ( self . eigen_vectors_ ) while self . prefix + str ( name_prefix_offset ) in copy . get_column_names ( virtual = True , strings = True ) : name_prefix_offset += 1 expressions = [ copy [ feature ] - mean for feature , mean in zip ( self . features , self . means_ ) ] for i in range ( n_components ) : v = eigen_vectors [ : , i ] expr = dot_product ( expressions , v ) name = self . prefix + str ( i + name_prefix_offset ) copy [ name ] = expr return copy
Apply the PCA transformation to the DataFrame.
Apply the PCA transformation to the DataFrame .
'''Apply the PCA transformation to the DataFrame.

        :param df: A vaex DataFrame.
        :param n_components: The number of PCA components to retain.

        :return copy: A shallow copy of the DataFrame that includes the PCA components.
        :rtype: DataFrame
        '''
A shallow copy of the DataFrame that includes the PCA components.
A shallow copy of the DataFrame that includes the PCA components .
copy
self
df
A vaex DataFrame.
A vaex DataFrame .
n_components
The number of PCA components to retain.
The number of PCA components to retain .