def _build_interaction_matrix(self, ratings):
        """Builds interaction matrix.

        Args:
            ratings (pd.Dataframe): pandas DataFrame of the following format
                    userId	movieId	rating
                    20	1	924	     3.5
                    19	1	919	     3.5
                    86	1	2683	 3.5
                    61	1	1584	 3.5
                    23	1	1079	 4.0

        Returns:
            interaction_matrix (torch.sparse.Float):
            sparse user2item interaction matrix
        """
        csr_matrix = sp.coo_matrix(
            (
                ratings["rating"].astype(np.float32),
                (ratings["movieId"], ratings["userId"]),
            )
        )

        interaction_matrix = torch.sparse.LongTensor(
            torch.LongTensor([csr_matrix.row.tolist(), csr_matrix.col.tolist()]),
            torch.LongTensor(csr_matrix.data.astype(np.int32)),
        )

        return interaction_matrix
Builds interaction matrix.

        Args:
            ratings (pd.Dataframe): pandas DataFrame of the following format
                    userId	movieId	rating
                    20	1	924	     3.5
                    19	1	919	     3.5
                    86	1	2683	 3.5
                    61	1	1584	 3.5
                    23	1	1079	 4.0

        Returns:
            interaction_matrix (torch.sparse.Float):
            sparse user2item interaction matrix
        
catalyst/contrib/datasets/movielens.py