필터 지우기
필터 지우기

Calling a Function specific from a ToolBox

조회 수: 29 (최근 30일)
MILLER BIGGELAAR
MILLER BIGGELAAR 2022년 8월 23일
댓글: Steven Lord 2022년 8월 23일
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
  댓글 수: 2
MILLER BIGGELAAR
MILLER BIGGELAAR 2022년 8월 23일
Will you look at my code?
Chunru
Chunru 2022년 8월 23일
You post your code to see who can help you.

댓글을 달려면 로그인하십시오.


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

Community Treasure Hunt

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

Start Hunting!

Translated by