def test_12_34_and_zeros(self): """Compute mi for identical arrays [[1, 2], [2, 4]].""" self.y_dataframe = InferelatorData(expression_data=np.zeros((2, 2))) self.clr_matrix, self.mi_matrix = mi.context_likelihood_mi( self.x_dataframe, self.y_dataframe) # the entire clr matrix is NAN self.assertTrue(np.isnan(self.clr_matrix.values).all())
def test_12_34_swapped(self): """Compute mi for identical arrays [[1, 2], [2, 4]].""" self.y_dataframe = L2.copy() self.clr_matrix, self.mi_matrix = mi.context_likelihood_mi( self.x_dataframe, self.y_dataframe) expected = np.array([[0, 1], [1, 0]]) np.testing.assert_almost_equal(self.clr_matrix.values, expected)
def test_12_34_transposed(self): "Compute mi for identical arrays [[1, 2], [2, 4]]." self.y_dataframe = InferelatorData( expression_data=np.array([[1, 2], [3, 4]])) self.clr_matrix, self.mi_matrix = mi.context_likelihood_mi( self.x_dataframe, self.y_dataframe) expected = np.array([[0, 1], [1, 0]]) np.testing.assert_almost_equal(self.clr_matrix.values, expected)