#NEWLINE# def trim_components( self , n_components = None ) : #NEWLINE# #INDENT# '\n        Permanently trims the components down to a certain amount. The number of\n        active components will be automatically reset to this particular value.\n\n        This will reduce `self.n_components` down to `n_components`\n        (if ``None``, `self.n_active_components` will be used), freeing up\n        memory in the process.\n\n        Once the model is trimmed, the trimmed components cannot be recovered.\n\n        Parameters\n        ----------\n        n_components: `int` >= ``1`` or `float` > ``0.0`` or ``None``, optional\n            The number of components that are kept or else the amount (ratio)\n            of variance that is kept. If ``None``, `self.n_active_components` is\n            used.\n\n        Notes\n        -----\n        In case `n_components` is greater than the total number of components or\n        greater than the amount of variance currently kept, this method does\n        not perform any action.\n        ' #NEWLINE# if ( n_components is None ) : #NEWLINE# #INDENT# n_components = self . n_active_components #NEWLINE# #UNINDENT# self . n_active_components = n_components #NEWLINE# if ( self . n_active_components < self . n_components ) : #NEWLINE# #INDENT# nac = self . n_active_components #NEWLINE# self . _components = self . _components [ : nac ] . copy ( ) #NEWLINE# self . _trimmed_eigenvalues = np . hstack ( ( self . _trimmed_eigenvalues , self . _eigenvalues [ self . n_active_components : ] ) ) #NEWLINE# self . _eigenvalues = self . _eigenvalues [ : nac ] . copy ( )