从Python数据中学习二进制决策图(BDD) [英] Learning Binary Decision Diagrams (BDDs) from data in Python

查看:80
本文介绍了从Python数据中学习二进制决策图(BDD)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从数据中学习二元决策图(BDD)(以机器学习方式)?如果可以,怎么办?

背景:我已经在Python中看到了一些工具,例如在具有

前三列对应于输入"数据集(xi),标签为(y).N对应于计数,您可以使用后者来计算准确性.请注意,这不是

dd 软件包可通过 PyPI 安装,其中:/p>

  pip install dd 

Is it possible to learn Binary Decision Diagrams (BDDs) from data (as in a machine learning fashion)? If so, how?

Background: I've seen some tools in Python to do this task in e.g., Decision Trees (DTs) with scikit-learn, but I have not seen any for BDDs.

As an example, what I want to do is the following:

The first three columns correspond to the 'input' data set (xi), and the label is (y). N corresponds to the counts, you could use the latter for instance to compute the accuracy. Be aware that this is not a cut sets matrix. In the center, you see one corresponding BDD (this is the diagram I want to obtain) and on the right a corresponding DT.

解决方案

If the objective is to convert the table of input-output valuations to a BDD that represents the Boolean function defined by those valuations, then yes this is possible (it is not any form of learning). For example, using the Python package 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])

we obtain the following diagram that includes complemented edges:

The package dd can be installed from PyPI with:

pip install dd

这篇关于从Python数据中学习二进制决策图(BDD)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆