資源簡介
機器學(xué)習(xí)貝葉斯學(xué)習(xí)器的經(jīng)典算法,關(guān)于是否去打網(wǎng)球的源代碼
代碼片段和文件信息
//樸素貝葉斯學(xué)習(xí)器算法c語言代碼實現(xiàn)
#include?“stdio.h“
//天氣類型
enum?enum_outlook
{
sunny?=?0
overcast?=?1
rain?=?2
}_outlook;
//溫度類型
enum?enum_temperature
{
hot?=?0
mild?=?1
cool?=?2
}_temperature;
//濕度類型
enum?enum_humidity
{
high?=?0
normal?=?1
}_humidity;
//風(fēng)強度類型
enum?enum_wind
{
weak?=?0
strong?=?1
}_wind;
//目標(biāo)類型
enum?enum_targetAttribute
{
yes?=?0
no?=?1
}_targetAttribute;
//訓(xùn)練實例
#define?TRAIN_NUM?14??????//定義14個訓(xùn)練實例
#define?ATTR_NUM?4????????//每個訓(xùn)練實例有4個屬性
int?trainSample[][ATTR_NUM?+?1]?=?{
{
sunnyhothighweakno
}
{
sunnyhothighstrongno
}
{
overcasthothighweakyes
}
{
rainmildhighweakyes
}
{
raincoolnormalweakyes
}
{
raincoolnormalstrongno
}
{
overcastcool
評論
共有 條評論