-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatapartition.m
More file actions
18 lines (18 loc) · 789 Bytes
/
datapartition.m
File metadata and controls
18 lines (18 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
%% Partitions the data into shuffled training and testing dataset
% Input: features, labels, split for training
% Outout: Train, Test, Train Labels, Test Labels
% Run from perceptron.m
function [train, test, labeltr, labelte]=datapartition(features, labels, split_tr)
features=full(features);
%% Random samples
% orderedArray=[labels,features];
% shuffledArray = orderedArray(randperm(size(orderedArray,1)),:);
% features=shuffledArray(:,2:end);
% labels=shuffledArray(:,1);
%% Data split into Train and test
train=features(1:split_tr,:);
labeltr=labels(1:split_tr,:);
test=features(split_tr+1:end,:);
labelte=labels(split_tr+1:end,:);
% shuffledArray = orderedArray(randperm(size(orderedArray,1)),:);
end