Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2aa4cfb

Browse files
author
linyiqun
committed
贝叶斯网络算法测试类
贝叶斯网络算法测试类
1 parent eb24cbd commit 2aa4cfb

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package DataMining_BayesNetwork;
2+
3+
import java.text.MessageFormat;
4+
5+
/**
6+
* 贝叶斯网络场景测试类
7+
*
8+
* @author lyq
9+
*
10+
*/
11+
public class Client {
12+
public static void main(String[] args) {
13+
String dataFilePath = "C:\\Users\\lyq\\Desktop\\icon\\input.txt";
14+
String attachFilePath = "C:\\Users\\lyq\\Desktop\\icon\\attach.txt";
15+
// 查询串语句
16+
String queryStr;
17+
// 结果概率
18+
double result;
19+
20+
// 查询语句的描述的事件是地震发生了,导致响铃响了,导致接到Mary的电话
21+
queryStr = "E=y,A=y,M=y";
22+
BayesNetWorkTool tool = new BayesNetWorkTool(dataFilePath,
23+
attachFilePath);
24+
result = tool.calProByNetWork(queryStr);
25+
26+
if (result == -1) {
27+
System.out.println("所描述的事件不满足贝叶斯网络的结构,无法求其概率");
28+
} else {
29+
System.out.println(String.format("事件%s发生的概率为%s", queryStr, result));
30+
}
31+
}
32+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /