cv partition for categorical values

1 view (last 30 days)
Ege
Ege on 4 Jan 2015
I am trying to use k fold cross validation for my dataset which has categorical and numerical features.
% Create a cvpartition object that defined the folds
c = cvpartition(Y,'holdout',.5);
% I tried c = cvpartition(Y,'kFold',3); as well
% Create a training set
x = array2table(X(training(c,1),:));
y = array2table(Y(training(c,1)));
% test set
u=array2table(X(test(c,1),:));
v=array2table(Y(test(c,1),:));
y.Properties.VariableNames{1} = 'churn';
v.Properties.VariableNames{1} = 'churn';
x.Properties.VariableNames(1:12)=adjusted_dataset.Properties.VariableNames(1:12);
u.Properties.VariableNames(1:12)=adjusted_dataset.Properties.VariableNames(1:12);
TrainingData= [x y];
TestDatawChurn=[u v];
After I execute this, it changes the categorical values into some random numbers. For example I see value 127 where it supposed to be 'yes'. What is it that I am doing wrong?

Answers (0)

Community Treasure Hunt

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

Start Hunting!