필터 지우기
필터 지우기

Changing the output of a neural network

조회 수: 1 (최근 30일)
John
John 2012년 2월 4일
Hi there,
I have a problem with the output of a neural network for data classification. The network has 4 target vectors.
Say for example the output (column vector) is
0.1 0 0.4 0.3
0.1 0.52 0.45 0.25
0.25 0.08 0.1 0.1
0.65 0.4 0.05 0.35
and then I round the output to get a one in each column, and get this
0 0 0 0
0 1 0 0
0 0 0 0
1 0 0 0
and then I use vec2ind(output) to return the rows that contain 1
It returns [4 2].
But columns 3 and 4 and are not classified.
How can I make it return the row with the highest probability estimate? So this example would return [4 2 2 4]
Many thanks

채택된 답변

Greg Heath
Greg Heath 2012년 2월 5일
>> t = [ 0 0 0 0 % target
0 1 1 0
0 0 0 0
1 0 0 1]
y = [ 0.1 0 0.4 0.3 % output
0.1 0.52 0.45 0.25
0.25 0.08 0.1 0.1
0.65 0.4 0.05 0.35 ]
[ ymax class] = max(y)
t =
0 0 0 0
0 1 1 0
0 0 0 0
1 0 0 1
y =
0.1000 0 0.4000 0.3000
0.1000 0.5200 0.4500 0.2500
0.2500 0.0800 0.1000 0.1000
0.6500 0.4000 0.0500 0.3500
ymax =
0.6500 0.5200 0.4500 0.3500
class =
4 2 2 4
Hope this helps.
Greg
  댓글 수: 1
Greg Heath
Greg Heath 2012년 2월 5일
If posterior probability estimates are desired, use the SOFTMAX activation function. However, if LOGSIG is used a reasonable approximation is to normalize the outputs to have a unity sum:
>> yn = y./repmat(sum(y),4,1)
yn =
0.0909 0 0.4000 0.3000
0.0909 0.5200 0.4500 0.2500
0.2273 0.0800 0.1000 0.1000
0.5909 0.4000 0.0500 0.3500
>> sum(yn)
ans =
1.0000 1.0000 1.0000 1.0000
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