how to control duplicate function names

6 ビュー (過去 30 日間)
jkr
jkr 2016 年 8 月 11 日
コメント済み: Greg Heath 2016 年 8 月 14 日
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 Center および File ExchangeParallel and Cloud についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by