def _run_epoch(self, item_features, user_features, interactions,
                   sample_weight, num_threads, loss):

        # Create shuffle indexes.
        shuffle_indices = np.arange(len(interactions.data), dtype=np.int32)
        self.rng.shuffle(shuffle_indices)

        lightfm_data = self._get_lightfm_data()

        # Call the estimation routines.
        if loss == 'warp':
            fit_warp(CSRMatrix(item_features),
                     CSRMatrix(user_features),
                     CSRMatrix(self._get_positives_lookup_matrix(interactions)),
                     interactions.row,
                     interactions.col,
                     interactions.data,
                     sample_weight,
                     shuffle_indices,
                     lightfm_data,
                     self.learning_rate,
                     self.item_alpha,
                     self.user_alpha,
                     num_threads,
                     self.rng)
        elif loss == 'bpr':
            fit_bpr(CSRMatrix(item_features),
                    CSRMatrix(user_features),
                    CSRMatrix(self._get_positives_lookup_matrix(interactions)),
                    interactions.row,
                    interactions.col,
                    interactions.data,
                    sample_weight,
                    shuffle_indices,
                    lightfm_data,
                    self.learning_rate,
                    self.item_alpha,
                    self.user_alpha,
                    num_threads,
                    self.rng)
        elif loss == 'warp-kos':
            fit_warp_kos(CSRMatrix(item_features),
                         CSRMatrix(user_features),
                         CSRMatrix(self._get_positives_lookup_matrix(interactions)),
                         interactions.row,
                         shuffle_indices,
                         lightfm_data,
                         self.learning_rate,
                         self.item_alpha,
                         self.user_alpha,
                         self.k,
                         self.n,
                         num_threads,
                         self.rng)
        else:
            fit_logistic(CSRMatrix(item_features),
                         CSRMatrix(user_features),
                         interactions.row,
                         interactions.col,
                         interactions.data,
                         sample_weight,
                         shuffle_indices,
                         lightfm_data,
                         self.learning_rate,
                         self.item_alpha,
                         self.user_alpha,
                         num_threads)
The idea is to allocate space in front of an expanding db.  If it gets
dataset/ETHPy150Open lyst/lightfm/lightfm/lightfm.py/LightFM._run_epoch--crossover with--dataset/ETHPy150Open openstack/swift/swift/common/db.py/DatabaseBroker._preallocate