Where in documentation does it say that fitnet([]) gives a linear model?

조회 수: 2 (최근 30일)
KAE
KAE 2018년 10월 4일
편집: KAE 2018년 10월 9일
I have seen Greg Heath's posts such as this one in which fitnet([]) is used to fit a linear model, i.e. with no hidden layers. But I can't find a reference in the fitnet documentation that this is the expected result of [] as an input, and I find this hard to spot in the fitnet.m code. Can someone please point me to a description in the documentation of the expected behavior of fitnet([])? I just want to understand this better.

채택된 답변

Greg Heath
Greg Heath 2018년 10월 4일
fitnet(H) yields H nodes in the hidden layer
A linear function needs no hidden layer
I could only think of 2 possibilities
a. net1 = fitnet(0), view(net1)
b. net2 = fitnet([]), view(net2)
So, as I did, try them out and see what happens.
Not sure if I checked the documentation.
Since I don't have MATLAB on this computer I can't check.
Also can't remember what happens when you try fitnet(0).
Hope this helps.
Greg
  댓글 수: 7
KAE
KAE 2018년 10월 9일
편집: KAE 2018년 10월 9일
As a side note, I am not sure how to reverse the scaling to regain the unscaled weight and bias values for the linear model y=mx+b. Here is what I tried,
weightBiasUnscaled = ...
mapminmax('reverse', [net.IW{1} net.b{1}],...
net.outputs{1}.processSettings{1});
% Unscaled weight
weightUnscaled = weightBiasUnscaled(1);
% Unscaled bias
biasUnscaled = weightBiasUnscaled(2);
However this gives a slope (weight) of -8.07 instead of the expected value of m=-5, and a bias (offset) of -5.5 not the expected value of b=-3 in y=mx+b. What am I doing wrong?
KAE
KAE 2018년 10월 9일
편집: KAE 2018년 10월 9일
MathWorks has confirmed that fitnet([]) produces a linear model like linear regression. They pointed me to this helpful post for background. I have asked them to add info on fitnet([]) to the documentation. Thanks all for your help!

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

추가 답변 (1개)

the cyclist
the cyclist 2018년 10월 4일
In the Input Arguments section of the documentation, where it discusses the hiddenSizes input, there is the sentence, "The length of the vector determines the number of hidden layers in the network."
Since the length of the empty vector is zero:
>> length([])
ans =
0
one can infer, I suppose, that there will be zero hidden layers. This could certainly be made more explicit, though. (I don't think I would have thought to try, had it not been for your question.)
I don't have access to the code, but I'm guessing that armed with the above knowledge, you can find where MATLAB determines the number of hidden layers from the length of that input.

카테고리

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