-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.m
46 lines (24 loc) · 853 Bytes
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
clear all
[xtrn, ytrn] = loadDataSet();
%% Mean error using KV
number_segments = 23;
indexes_partitions = get_indexs_kv_partitions(xtrn,number_segments);
for j=1:19
[x_train,y_train, x_test,y_test] = get_kv_partition(xtrn,ytrn,indexes_partitions,j);
model = train(x_train,y_train);
prediction = evalue(x_test, model);
wcp(j) = costFunction(prediction,y_test);
end
meanError = mean(wcp)
%% Error using same set to train and evalue
clear model prediction error
model = train(xtrn,ytrn);
prediction = evalue(xtrn, model);
error = costFunction(prediction,ytrn)
%% Error using some indexes
clear examplesIndex examples class prediction error
examplesIndex = [113, 5 10];
examples = xtrn(examplesIndex,:);
class = ytrn(examplesIndex);
prediction = evalue(examples,model);
error = costFunction(prediction,class)