Augur共识机制的独立实现
项目描述
pyconsensus是Augur共识机制的独立Python实现。详细信息,请参阅Augur白皮书。
安装
安装pyconsensus最简单的方法是使用pip
$ pip install pyconsensus
使用
要使用pyconsensus,请导入Oracle类
from pyconsensus import Oracle
# Example report matrix:
# - each row represents a reporter
# - each column represents an event in a prediction market
my_reports = [[0.2, 0.7, 1, 1],
[0.3, 0.5, 1, 1],
[0.1, 0.7, 1, 1],
[0.5, 0.7, 2, 1],
[0.1, 0.2, 2, 2],
[0.1, 0.2, 2, 2]]
reputation = [1, 2, 10, 9, 4, 2]
my_event_bounds = [
{"scaled": True, "min": 0.1, "max": 0.5},
{"scaled": True, "min": 0.2, "max": 0.7},
{"scaled": False, "min": 1, "max": 2},
{"scaled": False, "min": 1, "max": 2},
]
oracle = Oracle(reports=my_reports,
reputation=reputation,
event_bounds=my_event_bounds)
oracle.consensus()
测试
单元测试在test/目录中。
pyconsensus与Augur模拟器结合使用,以执行随机的数值(蒙特卡洛)共识测试。有关详细信息,请参阅模拟器存储库。
项目详情
关闭
pyconsensus-0.5.8.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f83f60433b9e5f86a6d4e60b42921139c23d65d124e0aa1408b7caccf7d6b339 |
|
MD5 | 66657a9ca6a89f86f2a67ce936c014a1 |
|
BLAKE2b-256 | ee73f5397cdbf723fb5cdbcd0200bfad6c7baeee5da678c5887b3e5b0a8a3b08 |