iris.fbc

来自「数据挖掘中的bayes算法,很好的代码」· FBC 代码 · 共 40 行

FBC
40
字号
/*----------------------------------------------------------------------  domains----------------------------------------------------------------------*/dom(sepal_length) = IR;dom(sepal_width) = IR;dom(petal_length) = IR;dom(petal_width) = IR;dom(iris_type) = { Iris-setosa, Iris-versicolor, Iris-virginica };/*----------------------------------------------------------------------  full Bayes classifier----------------------------------------------------------------------*/fbc(iris_type) = {  prob(iris_type) = {    Iris-setosa    : 50,    Iris-versicolor: 50,    Iris-virginica : 50 };  prob(sepal_length,sepal_width,petal_length,petal_width|iris_type) = {    Iris-setosa    : N([5.006, 3.428, 1.462, 0.246],                       [0.124249],                       [0.0992163, 0.14369],                       [0.0163551, 0.011698, 0.0301592],                       [0.0103306, 0.00929796, 0.00606939, 0.0111061]),    Iris-versicolor: N([5.936, 2.77, 4.26, 1.326],                       [0.266433],                       [0.0851837, 0.0984694],                       [0.182898, 0.0826531, 0.220816],                       [0.0557796, 0.0412041, 0.073102, 0.0391061]),    Iris-virginica : N([6.588, 2.974, 5.552, 2.026],                       [0.404343],                       [0.0937633, 0.104004],                       [0.30329, 0.0713796, 0.304588],                       [0.0490939, 0.0476286, 0.0488245, 0.0754327]) };};/*----------------------------------------------------------------------  number of attributes: 5  number of tuples    : 150----------------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?