【发布时间】:2012-07-02 00:07:30
【问题描述】:
如何在 MATLAB 中对一行单独的单元格进行分类?
目前我可以像这样对单个列进行分类:
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
和上面的不同,我要分类:
A B C
Row A | 1 | 1 | 1 = a house
Row B | 1 | 2 | 1 = a garden
这是来自 MATLAB 网站的代码示例:
nb = NaiveBayes.fit(training, class)
nb = NaiveBayes.fit(..., 'param1', val1, 'param2', val2, ...)
我不明白param1、val1 等是什么。有人可以帮忙吗?
【问题讨论】:
标签: statistics machine-learning classification matlab