FCM regroupant datatables numériques et le file csv / excel

Bonjour, j'ai posé une question précédente qui a donné une réponse raisonnable et j'ai pensé que j'étais de return sur la bonne voie, Fuzzy c-means tcp dump clustering dans matlab. Le problème est l'étape de prétraitement des données ci-dessous tcp / udp que je voudrais exécuter à travers matlabs Algorithme de clustering fcm. Ma question:

1) Comment puis-je ou quelle serait la meilleure méthode pour convertir datatables de text dans les cellules en une valeur numérique? quelle devrait être la valeur numérique?

Edit: Mes données dans Excel ressemblent maintenant à ceci:

entrez la description de l'image ici

0,tcp,http,SF,239,486,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,8,8,0.00,0.00,0.00,0.00,1.00,0.00,0.00,19,19,1.00,0.00,0.05,0.00,0.00,0.00,0.00,0.00,normal. 

Voici un exemple de la façon dont je lirais datatables dans MATLAB. Vous avez besoin de deux choses: datatables elles-mêmes qui sont en format séparé par des virgules, ainsi que la list des fonctionnalités avec leurs types (numériques, nominaux).

 %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # lire la list des fonctionnalités %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); fid = fopen ('kddcup.names', 'rt'); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); C = textscan (fid, '% s% s', 'Delimiter', ':', 'HeaderLines', 1); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); fclose (fid); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # déterminer le type de fonctionnalités %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); C {2} = regexprep (C {2}, '. $', ''); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); atsortingbNom = [ismember (C {2}, 'symbolique'); vrai]; %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # caractéristiques nominales %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # string de format de construction utilisée pour lire / parsingr datatables réelles %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); frmt = cellule (1, numel (C {1})); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); frmt (ismember (C {2}, 'continue')) = {'% f'}; %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # fonctions numériques: lire comme numéro %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); frmt (ismember (C {2}, 'symbolique')) = {'% s'}; %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # caractéristiques nominales: lire comme string %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); frmt = [frmt {:}]; %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); frmt = [frmt '% s']; %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # append l'atsortingbut de class %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # read dataset %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); fid = fopen ('kddcup.data', 'rt'); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); C = textscan (fid, frmt, 'Delimiter', ','); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); fclose (fid); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # convertir les attributes nominaux en numériques %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); ind = find (atsortingbNom); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); G = cellule (numel (ind), 1); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); pour i = 1: numel (ind) %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); [C {ind (i)}, G {i}] = grp2idx (C {ind (i)}); %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); % # tous les sets de données numériques %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end atsortingbNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format ssortingng used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as ssortingng frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class atsortingbute %# read dataset fid = fopen('kddcup.data','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal atsortingbutes to numeric ind = find(atsortingbNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset M = cell2mat(C); 

Vous pouvez également consulter la class DATASET dans la Boîte à outils des statistics.