Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
ClassificationKNN.fit with cell array of strings as Y
Replies:
8
Last Post:
May 8, 2013 4:39 AM




Re: ClassificationKNN.fit with cell array of strings as Y
Posted:
May 7, 2013 12:55 PM


On 5/7/2013 11:07 AM, Jay wrote: > >> I am not sure where in the documentation you found your statement 1. >> Here's what I see when I look at the current documentation: >> http://www.mathworks.com/help/stats/classificationknn.fit.html >> >> Y  Grouping variables of response values with the same number of >> elements (rows) as X. Each entry in Y is the response to the data in >> the corresponding row of X. >> >> This does not say that the variable must be a numeric vector, but a >> grouping variable >> http://www.mathworks.com/help/stats/groupingvariables.html > > Hm, yes, correct. Here is what I was referring to: > http://www.mathworks.de/de/help/stats/classificationknnclass.html > > Y Numeric vector of response values with the same number of rows as > X. Each entry in Y is the response to the data in the corresponding > row of X. > >> As far as your problem 2, I am not sure what is going on. I wonder if >> your function myDistance is giving you a problem somehow. > > So you believe everything should work fine when using a cell array of > strings. I don't see how my distance function could cause such an > error. My distance function is defined as [ distance ] = myDistance( > obj1, objects) > and will always return at least "distance = zeros(size(objects, 1),1); > " or higher values.
There must be something strange about the German web site, because when I try to look at the documentation page for the ClassificationKNN class, I do not see the "Numeric vector..." that you do, even when I look at the R2012b version of the documentation. I will try to investigate this discrepancy. Thanks for reporting the issue.
And, as I said, I really do not know what is going on with the predict method that is causing those errors. I will try to look into it, but it might take a few days.
Alan Weiss MATLAB mathematical toolbox documentation



