本文整理汇总了Python中skbio.core.distance.DissimilarityMatrix.data[0,1]方法的典型用法代码示例。如果您正苦于以下问题:Python DissimilarityMatrix.data[0,1]方法的具体用法?Python DissimilarityMatrix.data[0,1]怎么用?Python DissimilarityMatrix.data[0,1]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skbio.core.distance.DissimilarityMatrix
的用法示例。
在下文中一共展示了DissimilarityMatrix.data[0,1]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_from_dm
# 需要导入模块: from skbio.core.distance import DissimilarityMatrix [as 别名]
# 或者: from skbio.core.distance.DissimilarityMatrix import data[0,1] [as 别名]
def test_init_from_dm(self):
"""Constructs a dm from a dm."""
ids = ['foo', 'bar', 'baz']
# DissimilarityMatrix -> DissimilarityMatrix
exp = DissimilarityMatrix(self.dm_3x3_data, ids)
obs = DissimilarityMatrix(self.dm_3x3, ids)
self.assertEqual(obs, exp)
# Test that copy of data is not made.
self.assertTrue(obs.data is self.dm_3x3.data)
obs.data[0, 1] = 424242
self.assertTrue(np.array_equal(obs.data, self.dm_3x3.data))
# DistanceMatrix -> DissimilarityMatrix
exp = DissimilarityMatrix(self.dm_3x3_data, ids)
obs = DissimilarityMatrix(
DistanceMatrix(self.dm_3x3_data, ('a', 'b', 'c')), ids)
self.assertEqual(obs, exp)
# DissimilarityMatrix -> DistanceMatrix
with self.assertRaises(DistanceMatrixError):
DistanceMatrix(self.dm_2x2_asym, ['foo', 'bar'])