@relation weather
@attribute outlook {'overcast','rainy','sunny'}
@attribute temperature numeric
@attribute humidity numeric
@attribute windy {'FALSE','TRUE'}
@attribute play {'no','yes'}
@attribute attr numeric
@data
'sunny',85,85,'FALSE','no',4
'sunny',80,90,'TRUE','no',9
'overcast',83,86,'FALSE','yes',0
'rainy',70,96,'FALSE','yes',0
'rainy',68,80,'FALSE','yes',0
'rainy',65,70,'TRUE','no',4
'overcast',64,65,'TRUE','yes',0
'sunny',72,95,'FALSE','no',3
'sunny',69,70,'FALSE','yes',0
'rainy',75,80,'FALSE','yes',0
'sunny',75,70,'TRUE','yes',0
'overcast',72,90,'TRUE','yes',0
'overcast',81,75,'FALSE','yes',0
'rainy',71,91,'TRUE','no',8
以上是來自WEKA的weather.arff數據,我只是手動添加了一個人工屬性「attr」給它。請注意,「是」類樣本的所有「attr」值都是0.WEKA NaiveBayes分類器爲什麼會給出std。開發。全零屬性的值?
當我使用WEKA NaiveByes分類器構建模型(「使用訓練集「),輸出模型是這樣的:
=== Classifier model (full training set) ===
Naive Bayes Classifier
Class
Attribute no yes
(0.38) (0.63)
===============================
outlook
overcast 1.0 5.0
rainy 3.0 4.0
sunny 4.0 3.0
[total] 8.0 12.0
temperature
mean 74.8364 72.9697
std. dev. 7.384 5.2304
weight sum 5 9
precision 1.9091 1.9091
humidity
mean 86.1111 78.8395
std. dev. 9.2424 9.8023
weight sum 5 9
precision 3.4444 3.4444
windy
FALSE 3.0 7.0
TRUE 4.0 4.0
[total] 7.0 11.0
attr
mean 5.85 0
std. dev. 2.7 0.375
weight sum 5 9
precision 2.25 2.25
爲‘是‘ATTR’的類屬性’,有0的意思,但0.375 SD我想知道在WEKA NaiveBayes如何計算這一點。這是否使用了一些修正方法
此外,當我試圖插入符包來完成的?R:
library(caret)
library(foreign)
weather <- read.arff('weather.arff')
set.seed(1)
fit <- train(play ~., data = weather, method = 'nb', trControl = trainControl(method = 'none'), tuneGrid = data.frame(fL = 0, usekernel = F))
錯誤彈出說:
Error in NaiveBayes.default(x, y, usekernel = param$usekernel, fL = param$fL, :
Zero variances for at least one class in variables: attr
Called from: NaiveBayes.default(x, y, usekernel = param$usekernel, fL = param$fL,
...)
我怎樣才能讓R能夠忽略這一切歸零屬性情況,並給我一個(校正)模式?
我有同樣的問題;需要別人的幫助! – Yulong