是否可以从数据中学习二元决策图(BDD)(以机器学习的方式)?如果是这样,怎么办?
背景:我在 Python 中看到过一些工具可以完成此任务,例如决策树(DT)scikit学习,但我还没有看到任何 BDD。
举个例子,我想做的事情如下:
![enter image description here](https://i.stack.imgur.com/ZXeo9.png)
前三列对应于“输入”数据集(xi),标签为(y)。 N 对应于计数,您可以使用后者来计算准确性。请注意,这不是cut sets矩阵。在中间,你可以看到一个对应的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])
我们得到下图,其中包括互补边:
![enter image description here](https://i.stack.imgur.com/NZVgs.png)
套餐dd
可以从安装PyPI with:
pip install dd
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)