bn4r 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +12 -0
- data/README +71 -5
- data/doc/classes/BNTPGFromPositiveNegativeRelations.html +172 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000018.html +41 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000019.html +23 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000021.html +41 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000022.html +41 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000023.html +23 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000031.html +41 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000032.html +23 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000143.html +41 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000144.html +23 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000145.html +41 -0
- data/doc/classes/BNTPGFromPositiveNegativeRelations.src/M000146.html +23 -0
- data/doc/classes/BayesNet.html +561 -0
- data/doc/classes/BayesNet.src/M000001.html +22 -0
- data/doc/classes/BayesNet.src/M000002.html +25 -0
- data/doc/classes/BayesNet.src/M000003.html +18 -0
- data/doc/classes/BayesNet.src/M000004.html +18 -0
- data/doc/classes/BayesNet.src/M000005.html +18 -0
- data/doc/classes/BayesNet.src/M000006.html +19 -0
- data/doc/classes/BayesNet.src/M000007.html +18 -0
- data/doc/classes/BayesNet.src/M000008.html +20 -0
- data/doc/classes/BayesNet.src/M000009.html +19 -0
- data/doc/classes/BayesNet.src/M000010.html +18 -0
- data/doc/classes/BayesNet.src/M000011.html +23 -0
- data/doc/classes/BayesNet.src/M000012.html +25 -0
- data/doc/classes/BayesNet.src/M000013.html +27 -0
- data/doc/classes/BayesNet.src/M000014.html +43 -0
- data/doc/classes/BayesNet.src/M000015.html +34 -0
- data/doc/classes/BayesNet.src/M000016.html +39 -0
- data/doc/classes/BayesNet.src/M000017.html +38 -0
- data/doc/classes/BayesNet.src/M000018.html +33 -0
- data/doc/classes/BayesNet.src/M000019.html +20 -0
- data/doc/classes/BayesNet.src/M000020.html +36 -0
- data/doc/classes/BayesNet.src/M000021.html +53 -0
- data/doc/classes/BayesNet.src/M000022.html +18 -0
- data/doc/classes/BayesNet.src/M000023.html +18 -0
- data/doc/classes/BayesNet.src/M000024.html +18 -0
- data/doc/classes/BayesNet.src/M000025.html +19 -0
- data/doc/classes/BayesNet.src/M000026.html +18 -0
- data/doc/classes/BayesNet.src/M000027.html +20 -0
- data/doc/classes/BayesNet.src/M000028.html +19 -0
- data/doc/classes/BayesNet.src/M000029.html +18 -0
- data/doc/classes/BayesNet.src/M000030.html +23 -0
- data/doc/classes/BayesNet.src/M000091.html +25 -0
- data/doc/classes/BayesNet.src/M000092.html +18 -0
- data/doc/classes/BayesNet.src/M000093.html +18 -0
- data/doc/classes/BayesNet.src/M000094.html +18 -0
- data/doc/classes/BayesNet.src/M000095.html +19 -0
- data/doc/classes/BayesNet.src/M000096.html +18 -0
- data/doc/classes/BayesNet.src/M000097.html +20 -0
- data/doc/classes/BayesNet.src/M000098.html +19 -0
- data/doc/classes/BayesNet.src/M000099.html +18 -0
- data/doc/classes/BayesNet.src/M000100.html +23 -0
- data/doc/classes/BayesNet.src/M000101.html +25 -0
- data/doc/classes/BayesNet.src/M000102.html +27 -0
- data/doc/classes/BayesNet.src/M000103.html +43 -0
- data/doc/classes/BayesNet.src/M000104.html +34 -0
- data/doc/classes/BayesNet.src/M000105.html +39 -0
- data/doc/classes/BayesNet.src/M000106.html +38 -0
- data/doc/classes/BayesNet.src/M000107.html +33 -0
- data/doc/classes/BayesNet.src/M000108.html +18 -0
- data/doc/classes/BayesNet.src/M000109.html +35 -0
- data/doc/classes/BayesNet.src/M000110.html +22 -0
- data/doc/classes/BayesNet.src/M000111.html +18 -0
- data/doc/classes/BayesNet.src/M000112.html +18 -0
- data/doc/classes/BayesNet.src/M000113.html +18 -0
- data/doc/classes/BayesNet.src/M000114.html +19 -0
- data/doc/classes/BayesNet.src/M000115.html +18 -0
- data/doc/classes/BayesNet.src/M000116.html +20 -0
- data/doc/classes/BayesNet.src/M000117.html +19 -0
- data/doc/classes/BayesNet.src/M000118.html +18 -0
- data/doc/classes/BayesNet.src/M000119.html +23 -0
- data/doc/classes/BayesNet.src/M000120.html +25 -0
- data/doc/classes/BayesNet.src/M000121.html +27 -0
- data/doc/classes/BayesNet.src/M000122.html +43 -0
- data/doc/classes/BayesNet.src/M000123.html +33 -0
- data/doc/classes/BayesNet.src/M000124.html +39 -0
- data/doc/classes/BayesNet.src/M000125.html +38 -0
- data/doc/classes/BayesNet.src/M000126.html +33 -0
- data/doc/classes/BayesNetNode.html +477 -0
- data/doc/classes/BayesNetNode.src/M000020.html +22 -0
- data/doc/classes/BayesNetNode.src/M000021.html +21 -0
- data/doc/classes/BayesNetNode.src/M000022.html +18 -0
- data/doc/classes/BayesNetNode.src/M000023.html +22 -0
- data/doc/classes/BayesNetNode.src/M000024.html +22 -0
- data/doc/classes/BayesNetNode.src/M000025.html +21 -0
- data/doc/classes/BayesNetNode.src/M000026.html +18 -0
- data/doc/classes/BayesNetNode.src/M000027.html +18 -0
- data/doc/classes/BayesNetNode.src/M000028.html +18 -0
- data/doc/classes/BayesNetNode.src/M000029.html +18 -0
- data/doc/classes/BayesNetNode.src/M000030.html +18 -0
- data/doc/classes/BayesNetNode.src/M000031.html +19 -0
- data/doc/classes/BayesNetNode.src/M000032.html +19 -0
- data/doc/classes/BayesNetNode.src/M000033.html +18 -0
- data/doc/classes/BayesNetNode.src/M000034.html +18 -0
- data/doc/classes/BayesNetNode.src/M000035.html +26 -0
- data/doc/classes/BayesNetNode.src/M000036.html +18 -0
- data/doc/classes/BayesNetNode.src/M000037.html +20 -0
- data/doc/classes/BayesNetNode.src/M000038.html +18 -0
- data/doc/classes/BayesNetNode.src/M000039.html +23 -0
- data/doc/classes/BayesNetNode.src/M000040.html +52 -0
- data/doc/classes/BayesNetNode.src/M000041.html +19 -0
- data/doc/classes/BayesNetNode.src/M000042.html +18 -0
- data/doc/classes/BayesNetNode.src/M000043.html +18 -0
- data/doc/classes/BayesNetNode.src/M000044.html +26 -0
- data/doc/classes/BayesNetNode.src/M000045.html +18 -0
- data/doc/classes/BayesNetNode.src/M000046.html +20 -0
- data/doc/classes/BayesNetNode.src/M000047.html +18 -0
- data/doc/classes/BayesNetNode.src/M000048.html +23 -0
- data/doc/classes/BayesNetNode.src/M000049.html +52 -0
- data/doc/classes/BayesNetNode.src/M000050.html +22 -0
- data/doc/classes/BayesNetNode.src/M000051.html +21 -0
- data/doc/classes/BayesNetNode.src/M000052.html +18 -0
- data/doc/classes/BayesNetNode.src/M000053.html +18 -0
- data/doc/classes/BayesNetNode.src/M000054.html +18 -0
- data/doc/classes/BayesNetNode.src/M000055.html +18 -0
- data/doc/classes/BayesNetNode.src/M000056.html +18 -0
- data/doc/classes/BayesNetNode.src/M000057.html +19 -0
- data/doc/classes/BayesNetNode.src/M000058.html +19 -0
- data/doc/classes/BayesNetNode.src/M000059.html +18 -0
- data/doc/classes/BayesNetNode.src/M000060.html +18 -0
- data/doc/classes/BayesNetNode.src/M000061.html +26 -0
- data/doc/classes/BayesNetNode.src/M000062.html +18 -0
- data/doc/classes/BayesNetNode.src/M000063.html +20 -0
- data/doc/classes/BayesNetNode.src/M000064.html +18 -0
- data/doc/classes/BayesNetNode.src/M000065.html +23 -0
- data/doc/classes/BayesNetNode.src/M000066.html +52 -0
- data/doc/classes/BayesNetNode.src/M000147.html +22 -0
- data/doc/classes/BayesNetNode.src/M000148.html +21 -0
- data/doc/classes/BayesNetNode.src/M000149.html +18 -0
- data/doc/classes/BayesNetNode.src/M000150.html +18 -0
- data/doc/classes/BayesNetNode.src/M000151.html +18 -0
- data/doc/classes/BayesNetNode.src/M000152.html +18 -0
- data/doc/classes/BayesNetNode.src/M000153.html +18 -0
- data/doc/classes/BayesNetNode.src/M000154.html +19 -0
- data/doc/classes/BayesNetNode.src/M000155.html +19 -0
- data/doc/classes/BayesNetNode.src/M000156.html +18 -0
- data/doc/classes/BayesNetNode.src/M000157.html +18 -0
- data/doc/classes/BayesNetNode.src/M000158.html +26 -0
- data/doc/classes/BayesNetNode.src/M000159.html +18 -0
- data/doc/classes/BayesNetNode.src/M000160.html +20 -0
- data/doc/classes/BayesNetNode.src/M000161.html +18 -0
- data/doc/classes/BayesNetNode.src/M000162.html +23 -0
- data/doc/classes/BayesNetNode.src/M000163.html +52 -0
- data/doc/classes/BayesNetNode.src/M000164.html +22 -0
- data/doc/classes/BayesNetNode.src/M000165.html +21 -0
- data/doc/classes/BayesNetNode.src/M000166.html +18 -0
- data/doc/classes/BayesNetNode.src/M000167.html +18 -0
- data/doc/classes/BayesNetNode.src/M000168.html +18 -0
- data/doc/classes/BayesNetNode.src/M000169.html +18 -0
- data/doc/classes/BayesNetNode.src/M000170.html +18 -0
- data/doc/classes/BayesNetNode.src/M000171.html +19 -0
- data/doc/classes/BayesNetNode.src/M000172.html +18 -0
- data/doc/classes/BayesNetNode.src/M000173.html +18 -0
- data/doc/classes/BayesNetNode.src/M000174.html +26 -0
- data/doc/classes/BayesNetNode.src/M000175.html +18 -0
- data/doc/classes/BayesNetNode.src/M000176.html +20 -0
- data/doc/classes/BayesNetNode.src/M000177.html +18 -0
- data/doc/classes/BayesNetNode.src/M000178.html +23 -0
- data/doc/classes/BayesNetNode.src/M000179.html +52 -0
- data/doc/classes/Bn4rTest.html +549 -0
- data/doc/classes/Bn4rTest.src/M000180.html +17 -0
- data/doc/classes/Bn4rTest.src/M000181.html +21 -0
- data/doc/classes/Bn4rTest.src/M000182.html +21 -0
- data/doc/classes/Bn4rTest.src/M000183.html +34 -0
- data/doc/classes/Bn4rTest.src/M000184.html +27 -0
- data/doc/classes/Bn4rTest.src/M000185.html +23 -0
- data/doc/classes/Bn4rTest.src/M000186.html +42 -0
- data/doc/classes/Bn4rTest.src/M000187.html +39 -0
- data/doc/classes/Bn4rTest.src/M000188.html +25 -0
- data/doc/classes/Bn4rTest.src/M000189.html +45 -0
- data/doc/classes/Bn4rTest.src/M000190.html +32 -0
- data/doc/classes/Bn4rTest.src/M000191.html +32 -0
- data/doc/classes/Bn4rTest.src/M000192.html +45 -0
- data/doc/classes/Bn4rTest.src/M000193.html +41 -0
- data/doc/classes/Bn4rTest.src/M000194.html +42 -0
- data/doc/classes/Bn4rTest.src/M000195.html +17 -0
- data/doc/classes/Bn4rTest.src/M000196.html +21 -0
- data/doc/classes/Bn4rTest.src/M000197.html +21 -0
- data/doc/classes/Bn4rTest.src/M000198.html +34 -0
- data/doc/classes/Bn4rTest.src/M000199.html +27 -0
- data/doc/classes/Bn4rTest.src/M000200.html +23 -0
- data/doc/classes/Bn4rTest.src/M000201.html +42 -0
- data/doc/classes/Bn4rTest.src/M000202.html +39 -0
- data/doc/classes/Bn4rTest.src/M000203.html +25 -0
- data/doc/classes/Bn4rTest.src/M000204.html +45 -0
- data/doc/classes/Bn4rTest.src/M000205.html +32 -0
- data/doc/classes/Bn4rTest.src/M000206.html +32 -0
- data/doc/classes/BnTableProbabilitiesGenerator.html +143 -0
- data/doc/classes/BnTableProbabilitiesGenerator.src/M000036.html +18 -0
- data/doc/classes/BnTableProbabilitiesGenerator.src/M000040.html +18 -0
- data/doc/classes/BnTableProbabilitiesGenerator.src/M000041.html +18 -0
- data/doc/classes/BnTableProbabilitiesGenerator.src/M000067.html +18 -0
- data/doc/classes/BnTableProbabilitiesGenerator.src/M000207.html +18 -0
- data/doc/classes/BnTableProbabilitiesGenerator.src/M000208.html +18 -0
- data/doc/classes/ConfigTable/BoolItem.html +154 -0
- data/doc/classes/ConfigTable/BoolItem.src/M000028.html +18 -0
- data/doc/classes/ConfigTable/BoolItem.src/M000029.html +18 -0
- data/doc/classes/ConfigTable/ExecItem.html +201 -0
- data/doc/classes/ConfigTable/ExecItem.src/M000047.html +20 -0
- data/doc/classes/ConfigTable/ExecItem.src/M000048.html +18 -0
- data/doc/classes/ConfigTable/ExecItem.src/M000049.html +18 -0
- data/doc/classes/ConfigTable/ExecItem.src/M000050.html +18 -0
- data/doc/classes/ConfigTable/ExecItem.src/M000051.html +22 -0
- data/doc/classes/ConfigTable/Item.html +250 -0
- data/doc/classes/ConfigTable/Item.src/M000054.html +22 -0
- data/doc/classes/ConfigTable/Item.src/M000055.html +18 -0
- data/doc/classes/ConfigTable/Item.src/M000056.html +18 -0
- data/doc/classes/ConfigTable/Item.src/M000057.html +18 -0
- data/doc/classes/ConfigTable/Item.src/M000058.html +18 -0
- data/doc/classes/ConfigTable/Item.src/M000059.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.html +325 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000034.html +19 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000035.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000036.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000037.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000038.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000039.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000040.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000041.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000042.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000043.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000044.html +18 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000045.html +19 -0
- data/doc/classes/ConfigTable/MetaConfigEnvironment.src/M000046.html +19 -0
- data/doc/classes/ConfigTable/PackageSelectionItem.html +169 -0
- data/doc/classes/ConfigTable/PackageSelectionItem.src/M000032.html +19 -0
- data/doc/classes/ConfigTable/PackageSelectionItem.src/M000033.html +18 -0
- data/doc/classes/ConfigTable/PathItem.html +139 -0
- data/doc/classes/ConfigTable/PathItem.src/M000031.html +18 -0
- data/doc/classes/ConfigTable/ProgramItem.html +139 -0
- data/doc/classes/ConfigTable/ProgramItem.src/M000030.html +18 -0
- data/doc/classes/ConfigTable/SelectItem.html +156 -0
- data/doc/classes/ConfigTable/SelectItem.src/M000052.html +19 -0
- data/doc/classes/ConfigTable/SelectItem.src/M000053.html +18 -0
- data/doc/classes/ConfigTable.html +500 -0
- data/doc/classes/ConfigTable.src/M000007.html +25 -0
- data/doc/classes/ConfigTable.src/M000008.html +18 -0
- data/doc/classes/ConfigTable.src/M000009.html +18 -0
- data/doc/classes/ConfigTable.src/M000010.html +18 -0
- data/doc/classes/ConfigTable.src/M000011.html +18 -0
- data/doc/classes/ConfigTable.src/M000012.html +18 -0
- data/doc/classes/ConfigTable.src/M000013.html +18 -0
- data/doc/classes/ConfigTable.src/M000014.html +18 -0
- data/doc/classes/ConfigTable.src/M000015.html +18 -0
- data/doc/classes/ConfigTable.src/M000016.html +19 -0
- data/doc/classes/ConfigTable.src/M000017.html +21 -0
- data/doc/classes/ConfigTable.src/M000018.html +20 -0
- data/doc/classes/ConfigTable.src/M000019.html +18 -0
- data/doc/classes/ConfigTable.src/M000020.html +25 -0
- data/doc/classes/ConfigTable.src/M000021.html +23 -0
- data/doc/classes/ConfigTable.src/M000022.html +20 -0
- data/doc/classes/ConfigTable.src/M000023.html +20 -0
- data/doc/classes/ConfigTable.src/M000024.html +23 -0
- data/doc/classes/ConfigTable.src/M000025.html +19 -0
- data/doc/classes/ConfigTable.src/M000026.html +18 -0
- data/doc/classes/ConfigTable.src/M000027.html +18 -0
- data/doc/classes/Enumerable.html +118 -0
- data/doc/classes/Errno/ENOTEMPTY.html +111 -0
- data/doc/classes/Errno.html +111 -0
- data/doc/classes/File.html +166 -0
- data/doc/classes/File.src/M000276.html +20 -0
- data/doc/classes/File.src/M000277.html +20 -0
- data/doc/classes/File.src/M000278.html +18 -0
- data/doc/classes/FileOperations.html +375 -0
- data/doc/classes/FileOperations.src/M000291.html +31 -0
- data/doc/classes/FileOperations.src/M000292.html +20 -0
- data/doc/classes/FileOperations.src/M000293.html +20 -0
- data/doc/classes/FileOperations.src/M000294.html +24 -0
- data/doc/classes/FileOperations.src/M000295.html +34 -0
- data/doc/classes/FileOperations.src/M000296.html +27 -0
- data/doc/classes/FileOperations.src/M000297.html +21 -0
- data/doc/classes/FileOperations.src/M000298.html +19 -0
- data/doc/classes/FileOperations.src/M000299.html +40 -0
- data/doc/classes/FileOperations.src/M000300.html +19 -0
- data/doc/classes/FileOperations.src/M000301.html +20 -0
- data/doc/classes/FileOperations.src/M000302.html +18 -0
- data/doc/classes/FileOperations.src/M000303.html +18 -0
- data/doc/classes/FileOperations.src/M000304.html +18 -0
- data/doc/classes/FileOperations.src/M000305.html +20 -0
- data/doc/classes/FileOperations.src/M000306.html +20 -0
- data/doc/classes/HookScriptAPI.html +308 -0
- data/doc/classes/HookScriptAPI.src/M000279.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000281.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000282.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000283.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000284.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000285.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000286.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000287.html +18 -0
- data/doc/classes/HookScriptAPI.src/M000288.html +20 -0
- data/doc/classes/HookScriptAPI.src/M000289.html +20 -0
- data/doc/classes/HookScriptAPI.src/M000290.html +20 -0
- data/doc/classes/Installer/Shebang.html +202 -0
- data/doc/classes/Installer/Shebang.src/M000272.html +23 -0
- data/doc/classes/Installer/Shebang.src/M000273.html +19 -0
- data/doc/classes/Installer/Shebang.src/M000274.html +19 -0
- data/doc/classes/Installer/Shebang.src/M000275.html +18 -0
- data/doc/classes/Installer.html +1148 -0
- data/doc/classes/Installer.src/M000209.html +21 -0
- data/doc/classes/Installer.src/M000210.html +18 -0
- data/doc/classes/Installer.src/M000211.html +17 -0
- data/doc/classes/Installer.src/M000212.html +18 -0
- data/doc/classes/Installer.src/M000213.html +18 -0
- data/doc/classes/Installer.src/M000214.html +18 -0
- data/doc/classes/Installer.src/M000215.html +18 -0
- data/doc/classes/Installer.src/M000216.html +18 -0
- data/doc/classes/Installer.src/M000217.html +23 -0
- data/doc/classes/Installer.src/M000218.html +18 -0
- data/doc/classes/Installer.src/M000221.html +18 -0
- data/doc/classes/Installer.src/M000225.html +18 -0
- data/doc/classes/Installer.src/M000226.html +18 -0
- data/doc/classes/Installer.src/M000227.html +20 -0
- data/doc/classes/Installer.src/M000229.html +18 -0
- data/doc/classes/Installer.src/M000233.html +36 -0
- data/doc/classes/Installer.src/M000234.html +25 -0
- data/doc/classes/Installer.src/M000235.html +24 -0
- data/doc/classes/Installer.src/M000236.html +19 -0
- data/doc/classes/Installer.src/M000237.html +18 -0
- data/doc/classes/Installer.src/M000238.html +18 -0
- data/doc/classes/Installer.src/M000239.html +21 -0
- data/doc/classes/Installer.src/M000240.html +18 -0
- data/doc/classes/Installer.src/M000241.html +20 -0
- data/doc/classes/Installer.src/M000242.html +18 -0
- data/doc/classes/Installer.src/M000243.html +21 -0
- data/doc/classes/Installer.src/M000244.html +18 -0
- data/doc/classes/Installer.src/M000245.html +22 -0
- data/doc/classes/Installer.src/M000246.html +18 -0
- data/doc/classes/Installer.src/M000247.html +23 -0
- data/doc/classes/Installer.src/M000248.html +18 -0
- data/doc/classes/Installer.src/M000249.html +20 -0
- data/doc/classes/Installer.src/M000250.html +19 -0
- data/doc/classes/Installer.src/M000251.html +19 -0
- data/doc/classes/Installer.src/M000252.html +20 -0
- data/doc/classes/Installer.src/M000253.html +30 -0
- data/doc/classes/Installer.src/M000254.html +20 -0
- data/doc/classes/Installer.src/M000260.html +19 -0
- data/doc/classes/Installer.src/M000261.html +20 -0
- data/doc/classes/Installer.src/M000264.html +19 -0
- data/doc/classes/Installer.src/M000268.html +26 -0
- data/doc/classes/Installer.src/M000269.html +25 -0
- data/doc/classes/Installer.src/M000270.html +29 -0
- data/doc/classes/Installer.src/M000271.html +26 -0
- data/doc/classes/SetupError.html +111 -0
- data/doc/classes/ToplevelInstaller.html +621 -0
- data/doc/classes/ToplevelInstaller.src/M000060.html +23 -0
- data/doc/classes/ToplevelInstaller.src/M000061.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000062.html +25 -0
- data/doc/classes/ToplevelInstaller.src/M000063.html +21 -0
- data/doc/classes/ToplevelInstaller.src/M000064.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000065.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000066.html +38 -0
- data/doc/classes/ToplevelInstaller.src/M000067.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000068.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000069.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000070.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000071.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000072.html +40 -0
- data/doc/classes/ToplevelInstaller.src/M000073.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000074.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000075.html +21 -0
- data/doc/classes/ToplevelInstaller.src/M000081.html +40 -0
- data/doc/classes/ToplevelInstaller.src/M000082.html +31 -0
- data/doc/classes/ToplevelInstaller.src/M000083.html +52 -0
- data/doc/classes/ToplevelInstaller.src/M000084.html +19 -0
- data/doc/classes/ToplevelInstaller.src/M000085.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000086.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000087.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000088.html +20 -0
- data/doc/classes/ToplevelInstaller.src/M000089.html +18 -0
- data/doc/classes/ToplevelInstaller.src/M000090.html +18 -0
- data/doc/classes/ToplevelInstallerMulti.html +398 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000127.html +21 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000128.html +21 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000129.html +23 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000130.html +29 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000131.html +22 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000132.html +21 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000133.html +21 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000134.html +20 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000135.html +20 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000136.html +20 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000137.html +21 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000138.html +21 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000139.html +25 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000140.html +18 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000141.html +18 -0
- data/doc/classes/ToplevelInstallerMulti.src/M000142.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +265 -0
- data/doc/files/lib/bn4r/bn_algorithms_rb.html +131 -0
- data/doc/files/lib/bn4r/bn_export_rb.html +125 -0
- data/doc/files/lib/bn4r/bn_import_rb.html +145 -0
- data/doc/files/lib/bn4r/bn_rb.html +135 -0
- data/doc/files/lib/bn4r/bn_table_probabilities_rb.html +141 -0
- data/doc/files/lib/bn4r/bn_table_probabilities_rb.src/M000001.html +28 -0
- data/doc/files/lib/bn4r/version_rb.html +101 -0
- data/doc/files/lib/bn4r_rb.html +114 -0
- data/doc/files/pkg/bn4r-0_1_0/lib/bn4r/bn_algorithms_rb.html +131 -0
- data/doc/files/pkg/bn4r-0_1_0/lib/bn4r/bn_rb.html +135 -0
- data/doc/files/pkg/bn4r-0_1_0/lib/bn4r/bn_table_probabilities_rb.html +115 -0
- data/doc/files/pkg/bn4r-0_1_0/lib/bn4r/version_rb.html +101 -0
- data/doc/files/pkg/bn4r-0_1_0/lib/bn4r_rb.html +114 -0
- data/doc/files/pkg/bn4r-0_1_0/test/bn4r_test_rb.html +101 -0
- data/doc/files/pkg/bn4r-0_1_0/test/test_helper_rb.html +108 -0
- data/doc/files/setup_rb.html +148 -0
- data/doc/files/setup_rb.src/M000006.html +18 -0
- data/doc/files/test/bn4r_test_rb.html +108 -0
- data/doc/files/test/bn_test_models_rb.html +175 -0
- data/doc/files/test/bn_test_models_rb.src/M000003.html +45 -0
- data/doc/files/test/bn_test_models_rb.src/M000004.html +41 -0
- data/doc/files/test/bn_test_models_rb.src/M000005.html +42 -0
- data/doc/files/test/print_bn_output_rb.html +134 -0
- data/doc/files/test/print_bn_output_rb.src/M000002.html +18 -0
- data/doc/files/test/test_helper_rb.html +108 -0
- data/doc/fr_class_index.html +30 -0
- data/doc/fr_file_index.html +34 -0
- data/doc/fr_method_index.html +67 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/bn4r/bn.rb +12 -1
- data/lib/bn4r/bn_algorithms.rb +10 -6
- data/lib/bn4r/bn_export.rb +156 -0
- data/lib/bn4r/bn_import.rb +65 -0
- data/lib/bn4r/bn_table_probabilities.rb +16 -2
- data/lib/bn4r/version.rb +1 -1
- data/test/bn4r_test.rb +11 -99
- data/test/bn_test_models.rb +95 -0
- data/test/dog-problem.bif +106 -0
- data/test/print_bn_output.rb +11 -0
- metadata +465 -2
data/lib/bn4r/bn.rb
CHANGED
@@ -25,8 +25,11 @@ class BayesNet < DirectedAdjacencyGraph
|
|
25
25
|
# with tag ( if tag is included, othewise the label is nil ).
|
26
26
|
def add_edge(parent, child, tag=nil)
|
27
27
|
raise "Nodes must be of the class BayesNetNodes" if parent.class != BayesNetNode or child.class != BayesNetNode
|
28
|
+
raise "Self relations not allowed in BayesNet" if parent == child
|
29
|
+
raise "Diferent BayesNetNodes with equal name: " + parent.name if parent.name == child.name
|
30
|
+
|
28
31
|
edge = super(parent, child)
|
29
|
-
child.parents << parent
|
32
|
+
child.parents << parent unless child.parents.include? parent
|
30
33
|
child.relations << tag if !tag.nil?
|
31
34
|
edge
|
32
35
|
end
|
@@ -142,6 +145,12 @@ class BayesNetNode
|
|
142
145
|
parents.size
|
143
146
|
end
|
144
147
|
|
148
|
+
# Function not implemented yet
|
149
|
+
def deep(visited_nodes=[])
|
150
|
+
#TODO: Make deep function
|
151
|
+
raise "Function not implemented yet"
|
152
|
+
end
|
153
|
+
|
145
154
|
# Returns true if the node is a root node ( doesn't have parents ).
|
146
155
|
def root?
|
147
156
|
return true if num_parents == 0
|
@@ -157,6 +166,8 @@ class BayesNetNode
|
|
157
166
|
return name + (value.nil? ? "" : (" = " + value.to_s))
|
158
167
|
end
|
159
168
|
|
169
|
+
# If givens don't exist, it adds them
|
170
|
+
#
|
160
171
|
# if givens is nil, then internal givens is assumed
|
161
172
|
# table must have probability values in order like BAD!!!
|
162
173
|
# [g0=pos0 & g1=pos0 & ... & node_value=pos0, ..., g0=pos0 & g1=pos0 & ... & node_value=posN,
|
data/lib/bn4r/bn_algorithms.rb
CHANGED
@@ -107,24 +107,27 @@ class BayesNet < DirectedAdjacencyGraph
|
|
107
107
|
#
|
108
108
|
# <b>x</b> --> query variable
|
109
109
|
#
|
110
|
-
# <b>e</b> --> variables with observed values
|
110
|
+
# <b>e</b> --> variables with observed values, must be a copy of the nodes
|
111
|
+
# in bn ( Can't be the BayesNetNodes instaces that are in bn ).
|
111
112
|
#
|
112
113
|
# <b>n</b> --> Number of samples generated
|
113
|
-
#
|
114
|
+
#
|
115
|
+
# WARNING: Clears the values of current bn!
|
114
116
|
def likelihood_weighting( x, e, n, bn = self )
|
115
117
|
|
116
118
|
retval = [0.0, 0.0]
|
117
119
|
n.times {
|
118
|
-
w_sample, w = weighted_sample(e)
|
119
|
-
value = w_sample.select { |v| v.name == x.name }[0].value
|
120
|
-
|
121
|
-
if value == x.value
|
120
|
+
w_sample, w = weighted_sample(e) # ask for a weighted_sample with given evidences
|
121
|
+
value = w_sample.select { |v| v.name == x.name }[0].value # select the value for the query variable
|
122
|
+
|
123
|
+
if value == (x.value || true) # if no value for x, ask for true
|
122
124
|
retval[1] += w
|
123
125
|
else
|
124
126
|
retval[0] += w
|
125
127
|
end
|
126
128
|
}
|
127
129
|
|
130
|
+
# Normalize results
|
128
131
|
norm = retval[1].to_f / (retval[0]+retval[1]).to_f
|
129
132
|
|
130
133
|
return [norm, 1-norm]
|
@@ -164,6 +167,7 @@ class BayesNet < DirectedAdjacencyGraph
|
|
164
167
|
#
|
165
168
|
# <b>e</b> --> variables with observed values
|
166
169
|
#
|
170
|
+
# WARNING: Clears the values of current bn!
|
167
171
|
def weighted_sample(e, bn = self)
|
168
172
|
|
169
173
|
nodes_ordered = bn.nodes_ordered_by_dependencies
|
@@ -0,0 +1,156 @@
|
|
1
|
+
##############################################################
|
2
|
+
#
|
3
|
+
# Export fuctions of Bayesian Network Library for Ruby
|
4
|
+
#
|
5
|
+
# Author: Sergio Espeja ( http://www.upf.edu/pdi/iula/sergio.espeja, sergio.espeja at gmail.com )
|
6
|
+
#
|
7
|
+
# Developed in: IULA ( http://www.iula.upf.es ) and
|
8
|
+
# in bee.com.es ( http://bee.com.es )
|
9
|
+
#
|
10
|
+
# == Export formats implemented
|
11
|
+
# * dot (Graphviz .dot files)
|
12
|
+
# * xbn (Microsoft Belief Networks)
|
13
|
+
#
|
14
|
+
##############################################################
|
15
|
+
|
16
|
+
|
17
|
+
#
|
18
|
+
class BayesNet < DirectedAdjacencyGraph
|
19
|
+
|
20
|
+
def to_dot(bn = self)
|
21
|
+
#TODO: label relations between nodes
|
22
|
+
#TODO: �print information about probabilities tables?
|
23
|
+
bn.to_dot_graph.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_xbn(bn = self)
|
27
|
+
#TODO beautify code using REXML
|
28
|
+
xbn_str = "<?xml version=\"1.0\"?>\n"
|
29
|
+
xbn_str += "<ANALYSISNOTEBOOK NAME=\"Notebook.bndefault\" ROOT=\"bndefault\">\n"
|
30
|
+
xbn_str += "<BNMODEL NAME=\"bndefault\"><STATICPROPERTIES><FORMAT>MSR DTAS XML</FORMAT>\n"
|
31
|
+
xbn_str += " <VERSION>1.0</VERSION>\n"
|
32
|
+
xbn_str += " <CREATOR>Microsoft Research DTAS</CREATOR>\n"
|
33
|
+
xbn_str += " </STATICPROPERTIES>\n"
|
34
|
+
xbn_str += " <DYNAMICPROPERTIES><PROPERTYTYPE NAME=\"DTASDG_Notes\" TYPE=\"stringarray\"><COMMENT>Notes on the diagram</COMMENT>\n"
|
35
|
+
xbn_str += " </PROPERTYTYPE>\n"
|
36
|
+
xbn_str += " <PROPERTYTYPE NAME=\"MS_Addins\" TYPE=\"stringarray\"/>\n"
|
37
|
+
xbn_str += " </DYNAMICPROPERTIES>\n"
|
38
|
+
|
39
|
+
xbn_str += xbn_variables(bn)
|
40
|
+
xbn_str += xbn_structure(bn)
|
41
|
+
xbn_str += xbn_distributions(bn)
|
42
|
+
|
43
|
+
xbn_str += " </BNMODEL>\n"
|
44
|
+
xbn_str += "</ANALYSISNOTEBOOK>\n"
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def xbn_variables(bn = self)
|
50
|
+
xbn_str = "<VARIABLES>\n"
|
51
|
+
#<VAR NAME=\"N_intr_le\" TYPE=\"discrete\" XPOS=\"17589\" YPOS=\"6435\">
|
52
|
+
# <FULLNAME>n_intr_le</FULLNAME>
|
53
|
+
# <STATENAME>Yes</STATENAME>
|
54
|
+
# <STATENAME>No</STATENAME>
|
55
|
+
#</VAR>
|
56
|
+
x_pos_index = 0; y_pos_index = 0 #; actual_deep = 0
|
57
|
+
bn.nodes_ordered_by_dependencies.each { |node|
|
58
|
+
if !node.root? and (y_pos_index == 0)
|
59
|
+
x_pos_index = 0; y_pos_index = 1
|
60
|
+
end
|
61
|
+
x_pos = 1000 + (6500*x_pos_index)
|
62
|
+
y_pos = 2500 + (5000*y_pos_index)
|
63
|
+
x_pos_index += 1
|
64
|
+
xbn_str += "<VAR NAME=\"#{node.name}\" TYPE=\"discrete\" XPOS=\"#{x_pos}\" YPOS=\"#{y_pos}\">\n"
|
65
|
+
xbn_str += "<FULLNAME>#{node.name}</FULLNAME>\n"
|
66
|
+
# TODO: Make statename match with node.outcomes
|
67
|
+
xbn_str += "<STATENAME>Yes</STATENAME>\n"
|
68
|
+
xbn_str += "<STATENAME>No</STATENAME>\n"
|
69
|
+
xbn_str += "</VAR>\n"
|
70
|
+
}
|
71
|
+
xbn_str += "</VARIABLES>\n"
|
72
|
+
end
|
73
|
+
|
74
|
+
def xbn_structure(bn = self)
|
75
|
+
xbn_str = "<STRUCTURE>\n"
|
76
|
+
bn.nodes_ordered_by_dependencies.each { |node|
|
77
|
+
next if node.root? #node.num_parents > 0
|
78
|
+
node.parents.each { |parent|
|
79
|
+
xbn_str += "<ARC PARENT=\"#{parent.name}\" CHILD=\"#{node.name}\"/>\n"
|
80
|
+
}
|
81
|
+
}
|
82
|
+
# <ARC PARENT=\"N_mass_le\" CHILD=\"Count\"/>
|
83
|
+
# <ARC PARENT=\"N_mass_count_le\" CHILD=\"Count\"/>
|
84
|
+
# <ARC PARENT=\"N_intr_le\" CHILD=\"Count\"/>
|
85
|
+
# <ARC PARENT=\"N_mass_le\" CHILD=\"Mass\"/>
|
86
|
+
# <ARC PARENT=\"N_mass_count_le\" CHILD=\"Mass\"/>
|
87
|
+
# <ARC PARENT=\"N_intr_le\" CHILD=\"Mass\"/>
|
88
|
+
xbn_str += "</STRUCTURE>\n"
|
89
|
+
end
|
90
|
+
|
91
|
+
def xbn_distributions(bn = self)
|
92
|
+
xbn_str = "<DISTRIBUTIONS>\n"
|
93
|
+
# With parents
|
94
|
+
# <DIST TYPE=\"discrete\">
|
95
|
+
# <CONDSET>
|
96
|
+
# <CONDELEM NAME=\"N_mass_le\"/>
|
97
|
+
# <CONDELEM NAME=\"N_mass_count_le\"/>
|
98
|
+
# <CONDELEM NAME=\"N_intr_le\"/>
|
99
|
+
# </CONDSET>
|
100
|
+
# <PRIVATE NAME=\"Count\"/>
|
101
|
+
# <DPIS>
|
102
|
+
# <DPI INDEXES=\"0 0 0 \">0.7 0.3 </DPI>
|
103
|
+
# <DPI INDEXES=\"0 0 1 \">0.3 0.7 </DPI>
|
104
|
+
# <DPI INDEXES=\"0 1 0 \">0.3 0.7 </DPI>
|
105
|
+
# <DPI INDEXES=\"0 1 1 \">0 1 </DPI>
|
106
|
+
# <DPI INDEXES=\"1 0 0 \">1 0 </DPI>
|
107
|
+
# <DPI INDEXES=\"1 0 1 \">0.7 0.3 </DPI>
|
108
|
+
# <DPI INDEXES=\"1 1 0 \">0.7 0.3 </DPI>
|
109
|
+
# <DPI INDEXES=\"1 1 1 \">0.3 0.7 </DPI>
|
110
|
+
# </DPIS>
|
111
|
+
# </DIST>
|
112
|
+
bn.nodes_ordered_by_dependencies.each { |node|
|
113
|
+
next if node.root?
|
114
|
+
xbn_str += "<DIST TYPE=\"discrete\">\n"
|
115
|
+
xbn_str += " <PRIVATE NAME=\"#{node.name}\"/>\n"
|
116
|
+
|
117
|
+
xbn_str += " <CONDSET>\n"
|
118
|
+
node.parents.each { |parent| xbn_str += " <CONDELEM NAME=\"#{parent.name}\"/>" }
|
119
|
+
xbn_str += " </CONDSET>\n"
|
120
|
+
|
121
|
+
xbn_str += " <DPIS>\n"
|
122
|
+
boolean_combinations = generate_boolean_combinations(node.num_parents)
|
123
|
+
boolean_combinations.each { |boolean_combination|
|
124
|
+
# TODO: Make probs based on outcomes
|
125
|
+
probs = [true, false].collect { |n_assignment| node.get_probability(n_assignment, boolean_combination) }
|
126
|
+
bc_str = boolean_combination.collect {|b| (b)?"0":"1"}.join(" ")
|
127
|
+
xbn_str += " <DPI INDEXES=\"#{bc_str} \">" + probs.join(" ") + " </DPI>\n"
|
128
|
+
#<DPI INDEXES=\"0 0 0 \">0.7 0.3 </DPI>
|
129
|
+
}
|
130
|
+
xbn_str += " </DPIS>\n"
|
131
|
+
xbn_str += "</DIST>\n"
|
132
|
+
}
|
133
|
+
|
134
|
+
|
135
|
+
# Without parents
|
136
|
+
# <DIST TYPE=\"discrete\">
|
137
|
+
# <PRIVATE NAME=\"N_intr_le\"/>
|
138
|
+
# <DPIS>
|
139
|
+
# <DPI>0.3 0.7 </DPI>
|
140
|
+
# </DPIS>
|
141
|
+
# </DIST>
|
142
|
+
bn.nodes_ordered_by_dependencies.each { |node|
|
143
|
+
next unless node.root?
|
144
|
+
xbn_str += "<DIST TYPE=\"discrete\">\n"
|
145
|
+
xbn_str += " <PRIVATE NAME=\"#{node.name}\"/>\n"
|
146
|
+
xbn_str += " <DPIS>\n"
|
147
|
+
probs = [true, false].collect { |n_assignment| node.get_probability(n_assignment) }
|
148
|
+
xbn_str += " <DPI>" + probs.join(" ") + " </DPI>\n"
|
149
|
+
xbn_str += " </DPIS>\n"
|
150
|
+
xbn_str += "</DIST>\n"
|
151
|
+
}
|
152
|
+
|
153
|
+
xbn_str += "</DISTRIBUTIONS>\n"
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
##############################################################
|
2
|
+
#
|
3
|
+
# Import fuctions of Bayesian Network Library for Ruby
|
4
|
+
#
|
5
|
+
# Author: Sergio Espeja ( http://www.upf.edu/pdi/iula/sergio.espeja, sergio.espeja at gmail.com )
|
6
|
+
#
|
7
|
+
# Developed in: IULA ( http://www.iula.upf.es ) and
|
8
|
+
# in bee.com.es ( http://bee.com.es )
|
9
|
+
#
|
10
|
+
# Based on work by Ryan Dahl in
|
11
|
+
# http://www.math.rochester.edu/people/grads/rld/bayesnets
|
12
|
+
#
|
13
|
+
# == Import formats implemented
|
14
|
+
# * XML BIF ( XML-based BayesNets Interchange Format ,
|
15
|
+
# http://www.cs.cmu.edu/afs/cs/user/fgcozman/www/Research/InterchangeFormat/ )
|
16
|
+
#
|
17
|
+
#
|
18
|
+
#
|
19
|
+
##############################################################
|
20
|
+
require 'rexml/document'
|
21
|
+
include REXML
|
22
|
+
|
23
|
+
#
|
24
|
+
class BayesNet < DirectedAdjacencyGraph
|
25
|
+
|
26
|
+
def create_from_xmlbif(file, bn=self)
|
27
|
+
doc = Document.new File.open(file, "r")
|
28
|
+
|
29
|
+
# first go through and add the variables
|
30
|
+
doc.elements.each("BIF/NETWORK/VARIABLE") { |variable|
|
31
|
+
|
32
|
+
name = variable.elements["NAME"]
|
33
|
+
|
34
|
+
outcomes = []
|
35
|
+
variable.elements.each("OUTCOME") { |outcome|
|
36
|
+
outcomes << outcome.text
|
37
|
+
}
|
38
|
+
# transform from text to boolean
|
39
|
+
if outcomes.size == 2 and outcomes.include?("true") and outcomes.include?("false")
|
40
|
+
outcomes = outcomes.collect {|o| o == "true"}
|
41
|
+
end
|
42
|
+
node = BayesNetNode.new( name.text, outcomes )
|
43
|
+
bn.add_vertex(node)
|
44
|
+
}
|
45
|
+
|
46
|
+
# for each variable we list, we will look up
|
47
|
+
# the conditional probability table for it.
|
48
|
+
|
49
|
+
doc.elements.each("BIF/NETWORK/DEFINITION/") { |definition|
|
50
|
+
node = get_variable( definition.elements["FOR"].text )
|
51
|
+
givens_array = []
|
52
|
+
definition.elements.each("GIVEN") { |given|
|
53
|
+
givens_array << get_variable( given.text )
|
54
|
+
}
|
55
|
+
|
56
|
+
table = definition.elements["TABLE"].text.split
|
57
|
+
|
58
|
+
givens_array.each { |g| bn.add_edge(g, node) }
|
59
|
+
|
60
|
+
node.set_probability_table(givens_array, table)
|
61
|
+
}
|
62
|
+
bn
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -56,10 +56,24 @@ class BNTPGFromPositiveNegativeRelations < BnTableProbabilitiesGenerator
|
|
56
56
|
def self.get_node_probability_from_boolean_combination(boolean_combination, type_of_position_impact)
|
57
57
|
num_eq = 0.0
|
58
58
|
boolean_combination.size.times { |i|
|
59
|
-
num_eq
|
60
|
-
num_eq
|
59
|
+
num_eq += 1.0 if type_of_position_impact[i] && boolean_combination[i]
|
60
|
+
num_eq += 1.0 if !type_of_position_impact[i] && !boolean_combination[i]
|
61
61
|
}
|
62
62
|
num_eq / boolean_combination.size.to_f
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
def generate_boolean_combinations(num)
|
67
|
+
boolean_combinations = []
|
68
|
+
(2**num).times { |i|
|
69
|
+
boolean_combination = Array.new(num, false)
|
70
|
+
actual_value = i
|
71
|
+
(num).times { |j|
|
72
|
+
boolean_combination[j] = !(actual_value%2 == 1)
|
73
|
+
actual_value = actual_value / 2
|
74
|
+
}
|
75
|
+
boolean_combinations << boolean_combination.reverse
|
76
|
+
}
|
77
|
+
boolean_combinations
|
78
|
+
end
|
79
|
+
|
data/lib/bn4r/version.rb
CHANGED
data/test/bn4r_test.rb
CHANGED
@@ -1,96 +1,8 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
require 'bn_test_models'
|
2
3
|
|
3
4
|
class Bn4rTest < Test::Unit::TestCase
|
4
5
|
|
5
|
-
# Returns the BayesNet used as example in "Artificial Intelligence A
|
6
|
-
# Modern Approach, Rusell & Norvig, 2nd Ed." pp.494
|
7
|
-
def self.bayes_net_aima
|
8
|
-
bn_aima = BayesNet.new
|
9
|
-
|
10
|
-
b = BayesNetNode.new("Burglary")
|
11
|
-
e = BayesNetNode.new("Earthquake")
|
12
|
-
a = BayesNetNode.new("Alarm")
|
13
|
-
j = BayesNetNode.new("JohnCalls")
|
14
|
-
m = BayesNetNode.new("MaryCalls")
|
15
|
-
|
16
|
-
bn_aima.add_vertex(b)
|
17
|
-
bn_aima.add_vertex(e)
|
18
|
-
bn_aima.add_vertex(a)
|
19
|
-
bn_aima.add_vertex(j)
|
20
|
-
bn_aima.add_vertex(m)
|
21
|
-
|
22
|
-
bn_aima.add_edge(b,a)
|
23
|
-
bn_aima.add_edge(e,a)
|
24
|
-
bn_aima.add_edge(a,j)
|
25
|
-
bn_aima.add_edge(a,m)
|
26
|
-
|
27
|
-
b.set_probability_table([], [0.001, 0.999] )
|
28
|
-
e.set_probability_table([], [0.002, 0.998] )
|
29
|
-
|
30
|
-
a.set_probability_table([b,e], [0.95, 0.05, 0.94, 0.06, 0.29, 0.61, 0.001,0.999] )
|
31
|
-
|
32
|
-
j.set_probability_table([a], [0.90,0.10,0.05,0.95])
|
33
|
-
m.set_probability_table([a], [0.70,0.30,0.01,0.99])
|
34
|
-
|
35
|
-
bn_aima
|
36
|
-
end
|
37
|
-
|
38
|
-
# Returns the BayesNet used as example in "Artificial Intelligence A
|
39
|
-
# Modern Approach, Rusell & Norvig, 2nd Ed." pp.510
|
40
|
-
def self.bayes_net_aima2
|
41
|
-
bn_aima = BayesNet.new
|
42
|
-
|
43
|
-
cloudy = BayesNetNode.new("Cloudy")
|
44
|
-
sprinkler = BayesNetNode.new("Sprinkler")
|
45
|
-
rain = BayesNetNode.new("Rain")
|
46
|
-
wetgrass = BayesNetNode.new("WetGrass")
|
47
|
-
|
48
|
-
bn_aima.add_vertex(cloudy)
|
49
|
-
bn_aima.add_vertex(sprinkler)
|
50
|
-
bn_aima.add_vertex(rain)
|
51
|
-
bn_aima.add_vertex(wetgrass)
|
52
|
-
|
53
|
-
bn_aima.add_edge(cloudy,sprinkler)
|
54
|
-
bn_aima.add_edge(cloudy,rain)
|
55
|
-
bn_aima.add_edge(sprinkler,wetgrass)
|
56
|
-
bn_aima.add_edge(rain,wetgrass)
|
57
|
-
|
58
|
-
cloudy.set_probability_table([], [0.5, 0.5] )
|
59
|
-
|
60
|
-
sprinkler.set_probability_table([cloudy], [0.1, 0.9, 0.5, 0.5] )
|
61
|
-
rain.set_probability_table([cloudy], [0.8, 0.2, 0.2, 0.8] )
|
62
|
-
|
63
|
-
wetgrass.set_probability_table([sprinkler, rain], [0.99, 0.01, 0.9, 0.1, 0.9, 0.1, 0.0, 1.0] )
|
64
|
-
bn_aima
|
65
|
-
end
|
66
|
-
|
67
|
-
def bayes_net_aaile
|
68
|
-
bn = BayesNet.new
|
69
|
-
rel = BayesNetNode.new("relational")
|
70
|
-
q = BayesNetNode.new("qualificative")
|
71
|
-
a = BayesNetNode.new("Adverbial")
|
72
|
-
bn.add_vertex(rel)
|
73
|
-
bn.add_vertex(q)
|
74
|
-
bn.add_vertex(a)
|
75
|
-
|
76
|
-
# ["preN", ...]
|
77
|
-
preN = BayesNetNode.new("preN")
|
78
|
-
bn.add_vertex(preN)
|
79
|
-
|
80
|
-
postN = BayesNetNode.new("postN")
|
81
|
-
bn.add_vertex(postN)
|
82
|
-
|
83
|
-
# bn.add_edge("ser")
|
84
|
-
# bn.add_edge("G")
|
85
|
-
# bn.add_edge("prep")
|
86
|
-
|
87
|
-
bn.add_edge(rel, preN)
|
88
|
-
bn.add_edge(q, preN)
|
89
|
-
bn.add_edge(a, preN)
|
90
|
-
bn.add_edge(q, postN)
|
91
|
-
|
92
|
-
bn
|
93
|
-
end
|
94
6
|
|
95
7
|
def setup
|
96
8
|
end
|
@@ -113,7 +25,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
113
25
|
end
|
114
26
|
|
115
27
|
def test_probability_assingment
|
116
|
-
bn_aima =
|
28
|
+
bn_aima = bayes_net_aima
|
117
29
|
b = bn_aima.get_variable("Burglary")
|
118
30
|
a = bn_aima.get_variable("Alarm")
|
119
31
|
j = bn_aima.get_variable("JohnCalls")
|
@@ -133,7 +45,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
133
45
|
end
|
134
46
|
|
135
47
|
def test_CPT_size
|
136
|
-
bn_aima =
|
48
|
+
bn_aima = bayes_net_aima
|
137
49
|
b = bn_aima.get_variable("Burglary")
|
138
50
|
a = bn_aima.get_variable("Alarm")
|
139
51
|
j = bn_aima.get_variable("JohnCalls")
|
@@ -146,7 +58,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
146
58
|
end
|
147
59
|
|
148
60
|
def test_base_methods
|
149
|
-
bn_aima =
|
61
|
+
bn_aima = bayes_net_aima
|
150
62
|
b = bn_aima.get_variable("Burglary")
|
151
63
|
a = bn_aima.get_variable("Alarm")
|
152
64
|
assert bn_aima.root?(b)
|
@@ -155,7 +67,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
155
67
|
end
|
156
68
|
|
157
69
|
def test_inference_by_enumeration
|
158
|
-
bn_aima =
|
70
|
+
bn_aima = bayes_net_aima
|
159
71
|
b = bn_aima.get_variable("Burglary")
|
160
72
|
e = bn_aima.get_variable("Earthquake")
|
161
73
|
a = bn_aima.get_variable("Alarm")
|
@@ -183,7 +95,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
183
95
|
end
|
184
96
|
|
185
97
|
def test_inference_by_enumeration_ask
|
186
|
-
bn_aima =
|
98
|
+
bn_aima = bayes_net_aima
|
187
99
|
b = bn_aima.get_variable("Burglary")
|
188
100
|
e = bn_aima.get_variable("Earthquake")
|
189
101
|
a = bn_aima.get_variable("Alarm")
|
@@ -209,7 +121,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
209
121
|
|
210
122
|
|
211
123
|
def test_table_probabilities_for_node
|
212
|
-
bn_aima =
|
124
|
+
bn_aima = bayes_net_aima
|
213
125
|
b = bn_aima.get_variable("Burglary")
|
214
126
|
e = bn_aima.get_variable("Earthquake")
|
215
127
|
a = bn_aima.get_variable("Alarm")
|
@@ -221,7 +133,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
221
133
|
|
222
134
|
def test_prior_sampling
|
223
135
|
|
224
|
-
bn =
|
136
|
+
bn = bayes_net_aima2
|
225
137
|
|
226
138
|
hash = Hash.new(0)
|
227
139
|
nodes_ordered = bn.nodes_ordered_by_dependencies
|
@@ -238,7 +150,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
238
150
|
when "WetGrass"
|
239
151
|
true
|
240
152
|
else
|
241
|
-
raise "Incorrect BayesNet created at
|
153
|
+
raise "Incorrect BayesNet created at bayes_net_aima2"
|
242
154
|
end
|
243
155
|
}
|
244
156
|
|
@@ -251,7 +163,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
251
163
|
end
|
252
164
|
|
253
165
|
def test_rejection_sampling
|
254
|
-
bn =
|
166
|
+
bn = bayes_net_aima2
|
255
167
|
|
256
168
|
rain = bn.get_variable("Rain").copy
|
257
169
|
sprinkler = bn.get_variable("Sprinkler").copy
|
@@ -269,7 +181,7 @@ class Bn4rTest < Test::Unit::TestCase
|
|
269
181
|
end
|
270
182
|
|
271
183
|
def test_likelihood_weighting
|
272
|
-
bn =
|
184
|
+
bn = bayes_net_aima2
|
273
185
|
|
274
186
|
rain = bn.get_variable("Rain").copy
|
275
187
|
sprinkler = bn.get_variable("Sprinkler").copy
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Returns the BayesNet used as example in "Artificial Intelligence A
|
2
|
+
# Modern Approach, Rusell & Norvig, 2nd Ed." pp.494
|
3
|
+
def bayes_net_aima
|
4
|
+
# Create BayesNet
|
5
|
+
bn_aima = BayesNet.new
|
6
|
+
|
7
|
+
# Create nodes for the Bayes Net (BayesNetNodes)
|
8
|
+
burglary = BayesNetNode.new("Burglary")
|
9
|
+
earthquake = BayesNetNode.new("Earthquake")
|
10
|
+
alarm = BayesNetNode.new("Alarm")
|
11
|
+
john_calls = BayesNetNode.new("JohnCalls")
|
12
|
+
mary_calls = BayesNetNode.new("MaryCalls")
|
13
|
+
|
14
|
+
# Add nodes ( vertex ) to the BayesNet
|
15
|
+
bn_aima.add_vertex(burglary)
|
16
|
+
bn_aima.add_vertex(earthquake)
|
17
|
+
bn_aima.add_vertex(alarm)
|
18
|
+
bn_aima.add_vertex(john_calls)
|
19
|
+
bn_aima.add_vertex(mary_calls)
|
20
|
+
|
21
|
+
# Add relations ( edges ) between nodes in the BayesNet
|
22
|
+
bn_aima.add_edge(burglary,alarm)
|
23
|
+
bn_aima.add_edge(earthquake,alarm)
|
24
|
+
bn_aima.add_edge(alarm,john_calls)
|
25
|
+
bn_aima.add_edge(alarm,mary_calls)
|
26
|
+
|
27
|
+
# Assign probabilities to each node
|
28
|
+
burglary.set_probability_table([], [0.001, 0.999] )
|
29
|
+
earthquake.set_probability_table([], [0.002, 0.998] )
|
30
|
+
|
31
|
+
alarm.set_probability_table([burglary,earthquake], [0.95, 0.05, 0.94, 0.06, 0.29, 0.61, 0.001,0.999] )
|
32
|
+
|
33
|
+
john_calls.set_probability_table([alarm], [0.90,0.10,0.05,0.95])
|
34
|
+
mary_calls.set_probability_table([alarm], [0.70,0.30,0.01,0.99])
|
35
|
+
|
36
|
+
bn_aima
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns the BayesNet used as example in "Artificial Intelligence A
|
40
|
+
# Modern Approach, Rusell & Norvig, 2nd Ed." pp.510
|
41
|
+
def bayes_net_aima2
|
42
|
+
bn_aima = BayesNet.new
|
43
|
+
|
44
|
+
cloudy = BayesNetNode.new("Cloudy")
|
45
|
+
sprinkler = BayesNetNode.new("Sprinkler")
|
46
|
+
rain = BayesNetNode.new("Rain")
|
47
|
+
wetgrass = BayesNetNode.new("WetGrass")
|
48
|
+
|
49
|
+
bn_aima.add_vertex(cloudy)
|
50
|
+
bn_aima.add_vertex(sprinkler)
|
51
|
+
bn_aima.add_vertex(rain)
|
52
|
+
bn_aima.add_vertex(wetgrass)
|
53
|
+
|
54
|
+
bn_aima.add_edge(cloudy,sprinkler)
|
55
|
+
bn_aima.add_edge(cloudy,rain)
|
56
|
+
bn_aima.add_edge(sprinkler,wetgrass)
|
57
|
+
bn_aima.add_edge(rain,wetgrass)
|
58
|
+
|
59
|
+
cloudy.set_probability_table([], [0.5, 0.5] )
|
60
|
+
|
61
|
+
sprinkler.set_probability_table([cloudy], [0.1, 0.9, 0.5, 0.5] )
|
62
|
+
rain.set_probability_table([cloudy], [0.8, 0.2, 0.2, 0.8] )
|
63
|
+
|
64
|
+
wetgrass.set_probability_table([sprinkler, rain], [0.99, 0.01, 0.9, 0.1, 0.9, 0.1, 0.0, 1.0] )
|
65
|
+
bn_aima
|
66
|
+
end
|
67
|
+
|
68
|
+
def bayes_net_aaile
|
69
|
+
bn = BayesNet.new
|
70
|
+
rel = BayesNetNode.new("relational")
|
71
|
+
q = BayesNetNode.new("qualificative")
|
72
|
+
a = BayesNetNode.new("Adverbial")
|
73
|
+
bn.add_vertex(rel)
|
74
|
+
bn.add_vertex(q)
|
75
|
+
bn.add_vertex(a)
|
76
|
+
|
77
|
+
# ["preN", ...]
|
78
|
+
preN = BayesNetNode.new("preN")
|
79
|
+
bn.add_vertex(preN)
|
80
|
+
|
81
|
+
postN = BayesNetNode.new("postN")
|
82
|
+
bn.add_vertex(postN)
|
83
|
+
|
84
|
+
# bn.add_edge("ser")
|
85
|
+
# bn.add_edge("G")
|
86
|
+
# bn.add_edge("prep")
|
87
|
+
|
88
|
+
bn.add_edge(rel, preN)
|
89
|
+
bn.add_edge(q, preN)
|
90
|
+
bn.add_edge(a, preN)
|
91
|
+
bn.add_edge(q, postN)
|
92
|
+
|
93
|
+
bn
|
94
|
+
end
|
95
|
+
|