Sunday, 15 June 2014

sorting - Labeling in timeseries data in matlab? -



sorting - Labeling in timeseries data in matlab? -

i had array distarray[] of 35*1 results distance computation of x time series(of sample) of 1 user x time series of 35 instances. in distarray[], first 7 values results camparison usera, next 8 values in sequence results comparing userb, next 10 belongs userc & lastly 10 belongs userd (7+8+10+10=35).

i want apply classifier on these results.prior this, want label values in way values results comparing 1 user have 1 label(e.g. in case, since first 7 computations of usera labeled 'ua', next 8 values labeled 'ub', next 10 labeled 'uc' , lastly 10 labeled 'ud'). in end, if distarray[] have values (distarray = [120,42,25,50,95,47,32,.....252]), if apply sort function on list, want labels sorted accordingly.

my code upto distance computation is:

queryfiledir = 'dirpath'; queryfile = dir( fullfile(queryfiledir,'queryfilename') ); queryfile = {queryfile.name}; trainingsampledir= 'dirpath'; trainingfiles = dir( fullfile(trainingsampledir,'*.somefileextension') ); trainingfiles = {trainingfiles.name}; distarray = []; resultingdist = []; i=1:length(queryfile) queryfilename = fullfile(queryfiledir,queryfile{i}); queryfile = dlmread(queryfilename, '', 2,0); xtimeseriesq=queryfile(:,1); %assigning x timeseries of query sample c1 j=i+1:length(trainingfiles) trainfilenames = fullfile(trainingsampledir,trainingfiles{j}); trainfiles = dlmread(trainfilenames, '', 2,0); xtimeseriest=trainfiles(:,1);%assigning x timeseries of training samples d1 resultingdist = dtw(xtimeseriesq,xtimeseriest); % distance computation using x-timeseries of query sample training samples distarray = [distarray; resultingdist]; %resultant distance array end end

matlab sorting label time-series

No comments:

Post a Comment