lis*_*jim 4 python machine-learning binary-decision-diagram machine-learning-model
是否可以从数据中学习二元决策图(BDD)(以机器学习的方式)?如果是这样,怎么办?
背景:我在 Python 中看到过一些工具可以在例如带有scikit-learn 的决策树(DT)中完成此任务,但我还没有看到任何用于 BDD 的工具。
举个例子,我想做的事情如下:
前三列对应于“输入”数据集(xi),标签为(y)。N 对应于计数,您可以使用后者来计算准确性。请注意,这不是割集矩阵。在中间,你可以看到一个对应的BDD(这是我想要获得的图),在右边是一个对应的DT。
如果目标是将输入输出评估表转换为表示由这些评估定义的布尔函数的 BDD,那么这是可能的(这不是任何形式的学习)。例如,使用 Python 包dd:
from dd import autoref
bdd = autoref.BDD()
bdd.declare('x1', 'x2', 'x3')
# These are the assignments to the input variables
# where the Boolean function is TRUE (the y).
# The assignments where the Boolean function is FALSE
# are not used in the disjunction below.
data = [
dict(x1=True, x2=False, x3=True),
dict(x1=True, x2=True, x3=False),
dict(x1=True, x2=True, x3=True)]
u = bdd.false
for d in data:
u |= bdd.cube(d) # disjunction so far
bdd.dump('example.png', roots=[u])
Run Code Online (Sandbox Code Playgroud)
我们得到下图,其中包括互补边:
该软件包可以通过PyPIdd安装:
pip install dd
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
641 次 |
| 最近记录: |