johnpher

To deal with the data, we have to load it to matlab and express it with variables.

%load data to matlab
rawdata = load(\'E:\Pattern Recognition\Data Mining Repository\adult\resource\converted_data.data\');

%get data of all fields
age = rawdata(:,1)\';
workclass = rawdata(:,2)\';
fnlwgt = rawdata(:,3)\';
education = rawdata(:,4)\';
education_num = rawdata(:,5)\';
marital_status = rawdata(:,6)\';
occupation = rawdata(:,7)\';
relationship = rawdata(:,8)\';
race = rawdata(:,9)\';
sex = rawdata(:,10)\';
capital_gain = rawdata(:,11)\';
capital_loss = rawdata(:,12)\';
hours_per_week = rawdata(:,13)\';
native_country = rawdata(:,14)\';
isover5 = rawdata(:,15)\';

[i,j] = size(rawdata);

image(1)
range = (1:1:100);
[n,m] = hist(age,range);
plot(range, n);
hold on
plot(range, n);

In this way, we get the distribution of all ages in the survey:

分类:

技术点:

相关文章: