В моей модели нейронной сети точность теста снижается на итерации. Я проверил скорость обучения и настроил ее меньше, но точность моего теста продолжает снижаться, но не колеблется, поэтому я думаю, что это не причина проблемы.
Я использую правило обучения темпотрона и работаю с набором данных Iris, в котором я использую 100 обучающих образцов и 50 тестовых образцов.
Я проверил свой код, точность теста в начале увеличилась, поэтому я думаю, что правило обучения работает с весом.
Но я не могу понять, почему после этого производительность снижается. Может у кого есть идеи? Спасибо.
for Iterate = 1:iteration %% Run 100 times
%% Test the correct rate each time
правильный = 0; для test_sample = 1: длина (тест)
% In each iteration, T = 100ms
for t = 1:T
for neuron = 1:neurons %% Response function for 48 neurons at time t
Response(neuron) = K(t,test(test_sample,neuron));
end
% Calculate PSP
for j = 1:3
V(j,t) = Response*weight(:,j) + V_rest;
end
end
%% find t_max: first index that V cross threshold
for j = 1:3
for timing = 1:T
if V(j,timing) >= threshold
t_max(j) = timing;
Max_state(j) = V(j,timing);
break;
end
end
V(j,t_max(j):end) = V(j,t_max(j)).*exp(-(Time(t_max(j):end)-Time(t_max(j)))/Tou_m);
end
[~,output_class] = min(t_max);
if output_class == test_target(test_sample)
correct = correct + 1;
end
конец
correct_rate(Итерация) = правильно/(длина(тест));
если итерация > 1
if correct_rate(Iterate) < correct_rate(Iterate-1)
fprintf('Correct rate decrease\n');
%break;
end
конец
%% Подготовка
for samples = 1:size(InputSpike,1) %% Training samples for each iteration
% In each iteration, T = 100ms
for t = 1:T
for neuron = 1:neurons %% Response function for 48 neurons at time t
Response(neuron) = K(t,InputSpike(samples,neuron));
end
% Calculate PSP
for j = 1:3
V(j,t) = Response*weight(:,j) + V_rest;
end
end
%% find t_max: first index that V cross threshold
for j = 1:3
for timing = 1:T
if V(j,timing) >= threshold
t_max(j) = timing;
Max_state(j) = V(j,timing);
break;
end
end
V(j,t_max(j):end) = V(j,t_max(j)).*exp(-(Time(t_max(j):end)-
Time(t_max(j)))/Tou_m);
end
[~,output_class] = min(t_max);
%% weight modify when error occurs
if train_target(samples) ~= output_class
for j = 1:3
if j == train_target(samples) %% error in target neuron
if Max_state(j) < threshold %% if P+ error occurs
for i = 1:neurons
%% for all t_i < t_max
if InputSpike(samples,i) < t_max(j)
%% weight modified
weight(i,j) = weight(i,j) + ...
lr*K(t_max(j),InputSpike(samples,i));
end
end
end
elseif j ~= train_target(samples) %% error on other 2 output neurons
if Max_state(j) >= threshold %% if P- error occurs
for i = 1:neurons
%% for all t_i < t_max
if InputSpike(samples,i) < t_max(j)
%% weight modified
weight(i,j) = weight(i,j) - ...
lr*K(t_max(j),InputSpike(samples,i));
end
end
end
end
end
%% for neurons that fired but weaker than target neuron
elseif train_target(samples) == output_class
for j = 1:3
if j ~= train_target(samples) %% other 2 output neurons
if Max_state(j) >= threshold
for i = 1:neurons %% P- error occurs
%% for all t_i < t_max
if InputSpike(samples,i) < t_max(j)
%% weight modified
weight(i,j) = weight(i,j) - ...
lr*K(t_max(j),InputSpike(samples,i));
end
end
end
end
end
end
end
конец