how to control duplicate function names

1 次查看(过去 30 天)
I am using the Neural Network toolbox and attempting to determine how a trained patternnet would classify some test data. The documentation indicates I should use "classify" for this purpose. However, when I do so, I get an error message, because (as documented by "which classify") an unrelated function named "classify" is found preferentially on my matlabpath (/Applications/MATLAB_R2016a.app/toolbox/stats/stats/classify.m). If I "examine package contents" (I'm on a Mac), in fact that stats version of classify is the only one found. If I "doc classify" I get the stats version (re: Discriminant analysis), but at the top there is a notation: "Other uses of classify: nnet/SeriesNetwork.classify", and if I follow the offered link I find documentation on the version of classify appropriate for neural networks. How can I make that version of "classify" the one found in response to a command-line entry or a script? The same problem pertains to "predict". This overloading of function names seems like a very bad idea - what gives?
  2 个评论
per isakson
per isakson 2016-8-11
编辑:per isakson 2016-8-11
Doc says
"[Ypred,scores] = classify(net,X) estimates the classes for the data in X using the trained network, net."
In this case classify is a method of the class, SeriesNetwork, and net is an object of that class.
I guess your first input argument is not an object of SeriesNetwork.
Walter Roberson
Walter Roberson 2016-8-11
patternnet and SeriesNetwork are not the same, so classify() cannot be used with a patternnet.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2016-8-11
  5 个评论
Walter Roberson
Walter Roberson 2016-8-11
You could use round() if the values from [0, 1]
Greg Heath
Greg Heath 2016-8-14
The NNET Roolbox has functions that convert vector output to classindices and vice versa.
classindices = [ 1 3 5 2 4 ]
target = full(ind2vec(classindices))
classindices = vec2ind(target)
Hope this helps.
Greg

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by