Azzera filtri
Azzera filtri

How do I apply structures for data manipulation of CSV data

1 visualizzazione (ultimi 30 giorni)
%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.

Risposte (0)

Categorie

Scopri di più su Timetables in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by