| 第973行: |
第973行: |
| | 在dit库中,我们可以创建这个: | | 在dit库中,我们可以创建这个: |
| | | | |
| − | import dit # importing dit library | + | <pre>import dit # importing dit library |
| | | | |
| | from dit.pid import PID_WB # importing the PID measure we want to use | | from dit.pid import PID_WB # importing the PID measure we want to use |
| 第1,005行: |
第1,005行: |
| | +--------+--------+--------+ | | +--------+--------+--------+ |
| | | | |
| − | """ | + | """</pre> |
| | | | |
| | dit对信息类型进行编码如下: | | dit对信息类型进行编码如下: |
| 第1,033行: |
第1,033行: |
| | 使用dit,代码如下: | | 使用dit,代码如下: |
| | | | |
| − | import dit # importing dit library | + | <pre>import dit # importing dit library |
| | | | |
| | from dit.pid import PID_WB # importing the PID measure we want to use | | from dit.pid import PID_WB # importing the PID measure we want to use |
| 第1,065行: |
第1,065行: |
| | +--------+--------+--------+ | | +--------+--------+--------+ |
| | | | |
| − | """ | + | """</pre> |
| | | | |
| | 正如我们所看到的,<math>X_1</math>和<math>X_2</math>提供的关于<math>Y</math>的信息是冗余的,换句话说,两者都提供。 | | 正如我们所看到的,<math>X_1</math>和<math>X_2</math>提供的关于<math>Y</math>的信息是冗余的,换句话说,两者都提供。 |
| 第1,088行: |
第1,088行: |
| | 代码是: | | 代码是: |
| | | | |
| − | import dit # importing dit library | + | <Pre>import dit # importing dit library |
| | | | |
| | from dit.pid import PID_WB # importing the PID measure we want to use | | from dit.pid import PID_WB # importing the PID measure we want to use |
| 第1,120行: |
第1,120行: |
| | +--------+--------+--------+ | | +--------+--------+--------+ |
| | | | |
| − | """ | + | """</pre> |
| | | | |
| | <math>X_1</math>和<math>X_2</math>传达的关于<math>Y</math>的唯一信息是{0:1},这是协同信息。 | | <math>X_1</math>和<math>X_2</math>传达的关于<math>Y</math>的唯一信息是{0:1},这是协同信息。 |
| 第1,126行: |
第1,126行: |
| | 下面介绍如何用dit库进行一次完整的部分信息分解实验:(以Williams和Beer(2010)<ref name="Paul" />为例,只需要更改调用的函数名称即可使用其他PID分解方法,详见https://dit.readthedocs.io/en/latest/measures/pid.html) | | 下面介绍如何用dit库进行一次完整的部分信息分解实验:(以Williams和Beer(2010)<ref name="Paul" />为例,只需要更改调用的函数名称即可使用其他PID分解方法,详见https://dit.readthedocs.io/en/latest/measures/pid.html) |
| | | | |
| − | 首先在python里导入dit.pit:In [1]: from dit.pid import * | + | 首先在python里导入dit.pit: |
| | + | |
| | + | <pre>In [1]: from dit.pid import *</pre> |
| | | | |
| − | 随后给出一个分布:In [2]: d = dit.Distribution(['000', '011', '102', '113'], [1/4]*4)
| + | 随后给出一个分布: |
| | | | |
| | + | <pre>In [2]: d = dit.Distribution(['000', '011', '102', '113'], [1/4]*4)</pre> |
| | | | |
| | + | 用给出的分布进行PID分解(更改“PID_"后面角标即可使用其他PID分解方法): |
| | | | |
| − | 用给出的分布进行PID分解(更改“PID_"后面角标即可使用其他PID分解方法):In [3]: PID_WB(d)
| + | <pre>In [3]: PID_WB(d)</pre> |
| | | | |
| − | 输出结果:Out[13]:
| + | 输出结果: |
| | + | |
| | + | <pre>Out[13]: |
| | | | |
| | +--------+--------+--------+ | | +--------+--------+--------+ |
| 第1,150行: |
第1,156行: |
| | | {0}{1} | 1.0000 | 1.0000 | | | | {0}{1} | 1.0000 | 1.0000 | |
| | | | |
| − | +--------+--------+--------+ | + | +--------+--------+--------+</pre> |
| | | | |
| | 另外还有专门实现PID计算的pietromarchesi库:https://github.com/pietromarchesi/pidpy | | 另外还有专门实现PID计算的pietromarchesi库:https://github.com/pietromarchesi/pidpy |