(self)
return cut
Return the number of selected components.
Return the number of selected components.
Return the number of selected components .
def _nselected_components(self):
        """Return the number of selected components."""
        if self._pca is None:
            return 0

        if self.ncomponents == 0:
            # Special "All" value
            max_comp = len(self._variance_ratio)
        else:
            max_comp = self.ncomponents

        var_max = self._cumulative[max_comp - 1]
        if var_max != numpy.floor(self.variance_covered / 100.0):
            cut = max_comp
            assert numpy.isfinite(var_max)
            self.variance_covered = int(var_max * 100)
        else:
            self.ncomponents = cut = numpy.searchsorted(
                self._cumulative, self.variance_covered / 100.0) + 1
        return cut
def _nselected_components ( self ) : if self . _pca is None : return 0 if self . ncomponents == 0 : # Special "All" value max_comp = len ( self . _variance_ratio ) else : max_comp = self . ncomponents var_max = self . _cumulative [ max_comp - 1 ] if var_max != numpy . floor ( self . variance_covered / 100.0 ) : cut = max_comp assert numpy . isfinite ( var_max ) self . variance_covered = int ( var_max * 100 ) else : self . ncomponents = cut = numpy . searchsorted ( self . _cumulative , self . variance_covered / 100.0 ) + 1 return cut