Borrar filtros
Borrar filtros

How do I apply structures for data manipulation of CSV data

1 visualización (últimos 30 días)
elvin eziama
elvin eziama el 28 de Mzo. de 2017
Comentada: Walter Roberson el 28 de Mzo. de 2017
%Import Existing Data
bank = ImportBankData('bank-full.csv');
names = bank.Properties.VarNames;
% Remove unnecessary double quotes from certain attributes
bank = datasetfun(@removequotes,bank,'DatasetOutput',true);
% Convert all the categorical variables into nominal arrays
[nrows, ncols] = size(bank);
category = false(1,ncols);
for i = 1:ncols
if isa(bank.(names{i}),'cell') || isa(bank.(names{i}),'nominal')
category(i) = true;
bank.(names{i}) = nominal(bank.(names{i}));
end
end
% Logical array keeping track of categorical attributes
catPred = category(1:end-1);
% Set the random number seed to make the results repeatable in this script
rng('default');
%Visualize Data
% Bank balance vs. Last call duration plot, differentiated by outcome of the campaign
gscatter(bank.balance,bank.duration,bank.y)
% Label the plot
xlabel('Bank balance')
ylabel('Last contact duration')
title('Outcome')
% Response
Y = bank.y;
disp('Marketing Campaign')
tabulate(Y)
% Predictor matrix
X = double(bank(:,1:end-1));
I have the following questions
  1. names = bank.properties.VarName
  2. Can Matlab automatically do the Removal of double quotes without writing the program?
  3. I want to apply structures in selecting my response just like 'bank.y'.
I tried applying machine learning with the techniques but it is nothing working for me. This ends up giving me Struct contents reference from a non-struct array object" when tried this names = bank.Properties.VarNames" with the same dataset from UCI.

Respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by