-
Notifications
You must be signed in to change notification settings - Fork 4
/
fourWayClass.m
64 lines (56 loc) · 2.76 KB
/
fourWayClass.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%-------------------------------------------------------------------------------
% Four-way classification: male-day/male-night/female-day/female-night
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
%% Label the combination with group labels, normalize, and load in data:
labelCombination();
whatNormalization = 'zscore';
TS_Normalize(whatNormalization,[0.5,1]);
unnormalizedData = load('HCTSA.mat');
normalizedData = load('HCTSA_N.mat');
% Set classification parameters:
cfnParams = GiveMeDefaultClassificationParams(unnormalizedData);
cfnParams.whatClassifier = 'svm_linear';
%-------------------------------------------------------------------------------
%% Plot time series from each class:
numTimeSeriesPerClass = 5;
TS_PlotTimeSeries(unnormalizedData,numTimeSeriesPerClass)
%-------------------------------------------------------------------------------
%% Classify labels using all features:
numNulls = 0; % do permutation-based significance testing
TS_Classify(normalizedData,cfnParams,numNulls);
%-------------------------------------------------------------------------------
%% PCA with annotations:
% *****FIGURE IN PAPER*****
annotateParams = struct('n',0,'textAnnotation','none','userInput',false,'maxL',600);
f = TS_PlotLowDim(normalizedData,'tSNE',false,annotateParams,cfnParams);
f.Position(3:4) = [417,384];
%-------------------------------------------------------------------------------
%% Get some top features:
numFeaturesDistr = 40; % plot class distributions for this many features
doNull = false; % whether to run nulls (slow) to compute statistical significance of individual features
if doNull
numNulls = 50;
else
numNulls = 0;
end
cfnParams.whatClassifier = 'fast_linear';
TS_TopFeatures(unnormalizedData,'classification',cfnParams,...
'numFeaturesDistr',numFeaturesDistr,...
'numNulls',numNulls)
%-------------------------------------------------------------------------------
%% Investigate some top features of interest specifically:
% (features from TS_TopFeatures)
featuresLook = [7051,... % MF_CompareTestSets_y_ar_4_rand_25_01_1_stdrats_median
3540,... % SB_MotifTwo_mean_duu
4610,... % SP_Summaries_fft_logdev_area_4_3
492,... % glscf_1_1_2
1156]; % noise titration
for i = 1:length(featuresLook)
TS_SingleFeature(unnormalizedData,featuresLook(i),true,true);
end
%-------------------------------------------------------------------------------
%% Focus in on SY_StdNthDer_1:
featureID = 751;
annotateParams = struct('n',15,'textAnnotation','none','userInput',false,'maxL',4320);
TS_FeatureSummary(featureID,unnormalizedData,true,annotateParams);