lundi 9 décembre 2019

Classifying a dataset with if

I am trying to classify my dataset. To do this I will use the 4th column of my dataset if the 4th column of the dataset is equal to 1 that row will added in new matrix called Q1 , if the 4th column of the dataset is equal to 2 that row will be added to matrix Q2.

My code:

i=input('Enter a start row: ');
j=input('Enter a end row: ');
search= importfiledataset('search-queries-features.csv',i,j);
[n,p]=size(search);
if j>p 
    disp('Please enter a smaller number!');
end
class_id = search(:,4)
for s=i : j
    if  class_id == 1 
        Q1[] == search(s,1:4)
    else
        Q2[] == search(s,1:4)
    end
end

Briefly I am trying to divide my dataset into two parts using for loops and if statements.

Aucun commentaire:

Enregistrer un commentaire