Naive Bayes matlab, row classification
Posted
by
Jungle Boogie
on Stack Overflow
See other posts from Stack Overflow
or by Jungle Boogie
Published on 2012-07-01T02:01:55Z
Indexed on
2012/07/01
3:16 UTC
Read the original article
Hit count: 309
How do you classify a row of seperate cells in matlab?
Atm I can classify single coloums like so:
training = [1;0;-1;-2;4;0;1]; % this is the sample data.
target_class = ['posi';'zero';'negi';'negi';'posi';'zero';'posi'];
% target_class are the different target classes for the training data; here 'positive' and 'negetive' are the two classes for the given training data
% Training and Testing the classifier (between positive and negative)
test = 10*randn(25, 1); % this is for testing. I am generating random numbers.
class = classify(test,training, target_class, 'diaglinear') % This command classifies the test data depening on the given training data using a Naive Bayes classifier
Unlike the above im looking at wanting to classify:
A B C
Row A | 1 | 1 | 1 = a house
Row B | 1 | 2 | 1 = a garden
Can anyone help?
Here is a code example from matlabs site:
nb = NaiveBayes.fit(training, class)
nb = NaiveBayes.fit(..., 'param1',val1, 'param2',val2, ...)
I dont understand what param1 is or what val1 etc should be?
© Stack Overflow or respective owner