I am getting an error on the last line saying Input and target has different samples, Any suggestions?
Show older comments
load pumpFeatures.mat
t = table2array(T(:,1:84));
Y = table2array(T(:,85));
% features (X) are stored in the first 84 columns and labels (Y) in the last column of the dataset 'data'
% Split features (X) and labels (Y)
X = table2array(T(:, 1:84));
%Y = table2array(T(:, 85));
% Define the size of the training set (e.g., 70%)
training_ratio = 0.7;
% Generate indices for the training and test sets
cv = cvpartition(size(T, 1), 'HoldOut', 1 - training_ratio);
% Split the features and labels into training and test sets
X_train = X(cv.training,:);
Y_train = Y(cv.training,:);
X_test = X(cv.test,:);
Y_test = Y(cv.test,:);
hiddenLayerSizes = [10];
net = feedforwardnet(hiddenLayerSizes);
net = configure(net, X_train, Y_train);
net.layers{end}.transferFcn = 'softmax'; % Softmax for multi-class classification
% Train the network
net = train(net,X_train,Y_train); --- Error Line Input and Target has different numbetr of samples
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!