def _init_covar(self, partial_fit, n_chunks): nsave = int(max(math.log(n_chunks, 2), 2)) # in case we do a one shot estimation, we want to re-initialize running_covar if not hasattr(self, '_covar') or not partial_fit: self._logger.debug("using %s moments for %i chunks" % (nsave, n_chunks)) self._covar = running_covar(xx=True, xy=False, yy=False, remove_mean=True, symmetrize=False, nsave=nsave) else: # check storage size vs. n_chunks of the new iterator old_nsave = self._covar.storage_XX.nsave if old_nsave < nsave or old_nsave > nsave: self.logger.info("adopting storage size") self._covar.storage_XX.nsave = nsave self._covar.storage_XY.nsave = nsave
def _init_covar(self, partial_fit, n_chunks): nsave = min(int(max(log(n_chunks, 2), 2)), self.ncov_max) if self._rc is not None and partial_fit: # check storage size vs. n_chunks of the new iterator old_nsave = self.nsave if old_nsave < nsave: self.logger.info("adapting storage size") self.nsave = nsave else: # in case we do a one shot estimation, we want to re-initialize running_covar self.logger.debug("using %s moments for %i chunks", nsave, n_chunks) self._rc = running_covar(xx=self.c00, xy=self.c0t, yy=self.ctt, remove_mean=self.remove_data_mean, symmetrize=self.reversible, sparse_mode=self.sparse_mode, modify_data=self.modify_data, column_selection=self.column_selection, diag_only=self.diag_only, nsave=nsave)