跳转到主要内容

Augur共识机制的独立实现

项目描述

https://badge.fury.io/py/pyconsensus.svg

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 (23.5 kB 查看哈希值)

上传时间 源码

支持