-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteam_testing_code.m
More file actions
59 lines (48 loc) · 2.28 KB
/
Copy pathteam_testing_code.m
File metadata and controls
59 lines (48 loc) · 2.28 KB
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
function [binary_output, probability_output] = team_testing_code(model, record, data_folder, index, verbose)
%==========================================================================
% Edit this function to add your team's testing code.
%==========================================================================
% Extract identification details from the record
patient_id = record.BidsFolder;
session_id = record.SessionID;
if isnumeric(session_id)
session_str = num2str(session_id);
else
session_str = char(session_id);
end
% Load physionlogical and algorithmic files as raw data matrices and header structures
[row, phys_sig, phys_hdr, algo_sig, algo_hdr] = load_challenge_data(data_folder, record, index);
% Pack physiological data symmetrically
phys_data.signals = phys_sig;
phys_data.labels = phys_hdr.Label;
phys_data.hdr = phys_hdr;
% Pack algorithmic data identically to handle hospital variations!
algo_data.signals = algo_sig;
algo_data.labels = algo_hdr.Label;
% --- ADDED FOR BIOSIG TIMING FIX ---
% Store total_seconds directly within algo_data so get_features doesn't rely on vector length
if isfield(algo_hdr, 'NRec') && isfield(algo_hdr, 'Dur')
algo_data.total_seconds = algo_hdr.NRec * algo_hdr.Dur;
else
algo_data.total_seconds = 0; % Fallback
end
% -----------------------------------
% Extract features
features = get_features(row, phys_data, algo_data);
% if verbose
% fprintf('%f,',features);
% end
% =====================================================================
% Run Classifier Inference
% =====================================================================
% if verbose
% fprintf(' Running model prediction\n');
% end
% Extract the object from the model structure
actual_tree_model = model.model_outcome;
% Run prediction on the features
[predicted_labels, posterior_scores] = predict(actual_tree_model, features);
% Format outputs to match expected numeric types
binary_output = int32(str2double(predicted_labels{1}));
probability_output = double(posterior_scores(1, 2));
end