what "target" do i put in iris dataset nntool matlab?

1.7k views Asked by At

I am new in using matlab so this might be easy. I am trying to make an iris dataset neural network in matlab using nntool(feed-forward back propagation network). but i cant find out what the target matrix should be. I also am trying to find (tried to create but still did nothing) a code for programming the same thing instead of using nntools. Can anyone help me out?

1

There are 1 answers

0
Junuxx On

The targets are the correct class labels. However, the Fisher iris dataset in Matlab has its target data in an cell array of strings (species), while nntool wants a numerical vector. So you'll have to convert it.

clear all;
load('fisheriris');
classnames = unique(species);
targets = zeros(1, numel(species));
for i = 1:3
    class(strcmp(species, classnames{i})) = i;
end

You now have a vector targets that can be loaded in nntool.