def _run_epoch(<EOL>self,<EOL>item_features,<EOL>user_features,<EOL>interactions,<EOL>sample_weight,<EOL>num_threads,<EOL>loss,<EOL>):
if loss in ("<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>positives_lookup = CSRMatrix(<EOL>self._get_positives_lookup_matrix(interactions)<EOL>)<EOL><DEDENT>shuffle_indices = np.arange(len(interactions.data), dtype=np.int32)<EOL>self.random_state.shuffle(shuffle_indices)<EOL>lightfm_data = self._get_lightfm_data()<EOL>if loss == "<STR_LIT>":<EOL><INDENT>fit_warp(<EOL>CSRMatrix(item_features),<EOL>CSRMatrix(user_features),<EOL>positives_lookup,<EOL>interactions.row,<EOL>interactions.col,<EOL>interactions.data,<EOL>sample_weight,<EOL>shuffle_indices,<EOL>lightfm_data,<EOL>self.learning_rate,<EOL>self.item_alpha,<EOL>self.user_alpha,<EOL>num_threads,<EOL>self.random_state,<EOL>)<EOL><DEDENT>elif loss == "<STR_LIT>":<EOL><INDENT>fit_bpr(<EOL>CSRMatrix(item_features),<EOL>CSRMatrix(user_features),<EOL>positives_lookup,<EOL>interactions.row,<EOL>interactions.col,<EOL>interactions.data,<EOL>sample_weight,<EOL>shuffle_indices,<EOL>lightfm_data,<EOL>self.learning_rate,<EOL>self.item_alpha,<EOL>self.user_alpha,<EOL>num_threads,<EOL>self.random_state,<EOL>)<EOL><DEDENT>elif loss == "<STR_LIT>":<EOL><INDENT>fit_warp_kos(<EOL>CSRMatrix(item_features),<EOL>CSRMatrix(user_features),<EOL>positives_lookup,<EOL>interactions.row,<EOL>shuffle_indices,<EOL>lightfm_data,<EOL>self.learning_rate,<EOL>self.item_alpha,<EOL>self.user_alpha,<EOL>self.k,<EOL>self.n,<EOL>num_threads,<EOL>self.random_state,<EOL>)<EOL><DEDENT>else:<EOL><INDENT>fit_logistic(<EOL>CSRMatrix(item_features),<EOL>CSRMatrix(user_features),<EOL>interactions.row,<EOL>interactions.col,<EOL>interactions.data,<EOL>sample_weight,<EOL>shuffle_indices,<EOL>lightfm_data,<EOL>self.learning_rate,<EOL>self.item_alpha,<EOL>self.user_alpha,<EOL>num_threads,<EOL>)<EOL><DEDENT>
Run an individual epoch.