本文整理汇总了Python中hail.linalg.BlockMatrix.random方法的典型用法代码示例。如果您正苦于以下问题:Python BlockMatrix.random方法的具体用法?Python BlockMatrix.random怎么用?Python BlockMatrix.random使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hail.linalg.BlockMatrix
的用法示例。
在下文中一共展示了BlockMatrix.random方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_random_uniform
# 需要导入模块: from hail.linalg import BlockMatrix [as 别名]
# 或者: from hail.linalg.BlockMatrix import random [as 别名]
def test_random_uniform(self):
uniform = BlockMatrix.random(10, 10, gaussian=False)
nuniform = uniform.to_numpy()
for row in nuniform:
for entry in row:
assert entry > 0
示例2: test_to_matrix_table
# 需要导入模块: from hail.linalg import BlockMatrix [as 别名]
# 或者: from hail.linalg.BlockMatrix import random [as 别名]
def test_to_matrix_table(self):
n_partitions = 2
rows, cols = 2, 5
bm = BlockMatrix._create(rows, cols, [float(i) for i in range(10)])
actual = bm.to_matrix_table_row_major(n_partitions)
expected = hl.utils.range_matrix_table(rows, cols)
expected = expected.annotate_entries(element=hl.float64(expected.row_idx * cols + expected.col_idx))
expected = expected.key_cols_by(col_idx=hl.int64(expected.col_idx))
expected = expected.key_rows_by(row_idx=hl.int64(expected.row_idx))
assert expected._same(actual)
bm = BlockMatrix.random(50, 100, block_size=25, seed=0)
mt = bm.to_matrix_table_row_major(n_partitions)
mt_round_trip = BlockMatrix.from_entry_expr(mt.element).to_matrix_table_row_major()
assert mt._same(mt_round_trip)
示例3:
# 需要导入模块: from hail.linalg import BlockMatrix [as 别名]
# 或者: from hail.linalg.BlockMatrix import random [as 别名]
import hail as hl
from hail.linalg import BlockMatrix
mt = hl.import_vcf('gs://hail-1kg/1kg_coreexome.vcf.bgz')
mt = mt.annotate_rows(x = 5)
mt._force_count_rows()
mt = hl.import_bgen('gs://hail-ci/example.8bits.bgen', entry_fields=['GT'])
mt._force_count_rows()
bm = BlockMatrix.random(10, 11)
bm.to_numpy(_force_blocking=True)
bm.to_numpy()