Calling a Function specific from a ToolBox

22 次查看(过去 30 天)
Hi again Mathworks people. :)
I am attempting to use the function classify() from the Deep Learning Toolbox, however it seems to call instead on the Statistic and Machine Learning function with the same name.
My question is: is there a way to specify where the function/which toolbox the function is called from?
this is the function I wish to use:
this is the function it is currently calling (which I do not want to use):
Thanks in advance!
Miller

采纳的回答

Steven Lord
Steven Lord 2022-8-23
The function you indicated you wanted to call is only called in the event that the first input argument is either "a SeriesNetwork or a DAGNetwork object". Is it? Let's see which version of the train function you're calling.
compnet = competlayer(3);
which -all train(compnet, rand(3))
/MATLAB/toolbox/nnet/nnet/@network/train.m % network method
This function returns a "Trained network, returned as a network object." A network object is neither a SeriesNetwork nor a DAGNetwork. What can you do with a network object?
methods network
Methods for class network: adapt disp genFunction init loadobj perform revert stack subsref unconfigure configure display gensim isconfigured network prune sim subsasgn train view
What happens when you try to classify a network?
which -all classify(network)
/MATLAB/toolbox/stats/stats/classify.m
If you want to use the classify function you need to work with a deep neural network, not a shallow neural network.
  2 个评论
MILLER BIGGELAAR
MILLER BIGGELAAR 2022-8-23
Can you please provide some helpful links so I can begin creating an operational one?
Steven Lord
Steven Lord 2022-8-23
I don't know exactly what you're trying to do, so the links to the SeriesNetwork and DAGNetwork pages in the first paragraph of my answer would probably be my first stop.
Alternately look for the sub-category on the list of functions in Deep Learning Toolbox to find the one that closest describes the application you're working on (processing image data, processing time series data, approximating a function, etc.) and see if there are pretrained networks or network creation functions in that sub-category.

请先登录,再进行评论。

更多回答(2 个)

Chunru
Chunru 2022-8-23
seriesnetwork is a calss. It has a method of "classify". In order to use the method, you need to create the network and train it. Then can call classify by
classify(net, ...) % where net is the network trained

MILLER BIGGELAAR
MILLER BIGGELAAR 2022-8-23
I have already, here is my code:
clear
clc
test = Iris_data;
label = zeros(150,1);
label(1:50,:) = 1;
label(51:100,:) = 2;
label(101:150,:) = 3;
test(:,5) = label;
k = randperm(150,50);
trainset = test(k(1:50),:);
trainsetlabel = test(k,5);
test(k,:) = [];
datalabel = test(:,5);
%%%%
compnet = competlayer(3);
compnet = train(compnet,trainset');
outputs = compnet(trainset');
classes = vec2ind(outputs);
testingnet = classify(compnet,test')
Attached is the data

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by