-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicra17_svm.m
28 lines (21 loc) · 1015 Bytes
/
icra17_svm.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
function [features, split_idx, bfeatures, bsplit_idx] = icra17_svm(data, mass)
materials = data.keys;
features = cell(0, 5); % cols: label, vibration, speed, normal, tangential
bfeatures = cell(0, 5); % cols: label, vibration, speed, normal, tangential
for m = 1:length(materials)
ep = data(materials{m});
fprintf('Romano features for %s\n', materials{m});
%%
new_feats = romano_features('pre', ep.iws, ep.vei, ep.ai, mass, 150, [5 .5], ep.ss);
%%
features = [features
num2cell(repmat(m, size(new_feats,1), 1)) new_feats];
new_feats = romano_features('pre', ep.biws, ep.bvei, ep.bai, mass, 150, [5 .5], ep.bss);
bfeatures = [bfeatures
num2cell(repmat(m, size(new_feats,1), 1)) new_feats];
end
% test/train split
% 4/5 train, 1/5 test
split_idx = randsample(1:2, size(features,1), true, [4/5 1/5]);
bsplit_idx = randsample(1:2, size(bfeatures,1), true, [4/5 1/5]);
end