0

パーセプトロン ニューラル ネットワークをトレーニングし、matlab を使用して重み行列を取得しました。

得られた重み行列の次元は <50x1 double> です

テスト入力を与えている間、テストする必要がある <1x1 double> 値があります。

重み行列に値を掛けると、<50x1 double> になります。<50x1 double> 値のしきい値を設定するにはどうすればよいですか。

この問題を回避する方法はありますか?

これがコードです

tic
clc; clear all; close all; 
%function [ w1, bias ] = percep1( x )

zzz = xlsread('D:\matlab\NN_FILES\train_mean.xlsx')
s = zzz;
learning_rate = 0.1; % go with the loop mohan
theta = 10000;
w1=0; 
for j = 1:50
    x=s(:,j);t=1; bias=0; stopp=1; count=0;
while stopp
    yin = bias + (w1*x);
    % activation function
    if yin > theta
         y = 1;
    elseif yin < -theta
        y = -1;
    else
        y = 0;
    end


    if (t ~= y)
    %     for i = 1 : 7
            %if ( x(i) ~= 0 )
                w1 = w1 + ( learning_rate * t * x);
            %end
    %    end
        bias = bias + ( learning_rate * t);
    end

    count = count + 1;

    if t==y
       stopp = 0;
       count;
    end
 end

 w(j,:) = w1;
 b1(j) = bias;
 e1(j) = count;
 end
 new_weights_2 = w(50,:)
 yyy= xlsread('D:\matlab\NN_FILES\test_mean.xlsx');
 st=yyy;
 theta2 = 1.0e+04 * 1.2 ;
 for j=1:20
     x=st(:,j);
     yin=(new_weights_2(1))*(x)
     output(j) = yin;     
     if yin > theta2
         y = 1;
     elseif yin < -theta2
         y = -1;
     else y = 0;
 end
 y1(j)=y;

end
toc

ここで、乗算規則を満たすために、重み行列の最初の値のみを使用しました。重み行列にテスト入力を掛ける方法はありますか?

4

0 に答える 0