classification using Quadratic Integrate and Fire Neuron

조회 수: 8 (최근 30일)
AJEET KUMAR VERMA
AJEET KUMAR VERMA 2019년 1월 25일
댓글: AJEET KUMAR VERMA 2019년 1월 26일
I have coded Quadratic Integrate and Fire neuron, referenced from the example code of IFN. Now I want to use this as a binary classifier. please help me out with this issue.
  댓글 수: 1
AJEET KUMAR VERMA
AJEET KUMAR VERMA 2019년 1월 26일
clear all;
clc;
close all;
figure
eta=0.1;
max=10;
tic
% load iris.dat % Iris data as Input
% data=iris;
data=csvread('dataset_3y_adcolna.csv');% Malaria data as Input
inputpatterns = data;
[m n] = size(inputpatterns);%m = no of rows, n = no of colums
w=rand(1,(n-1))*0.1;% initial values for a
b=rand(1,(n-1));% initial values for b
% % d=rand(1,(n-1))*0.2;% initial values for c
x=inputpatterns(:,1:(n-1));
t=inputpatterns(:,n)';
for z =1:1:max % z=no of iterations
product=ones(1,m);
for k=1:(n-1)
product=product.*(w(k)*x(:,k)+b(k))';% multiplicative weighted sum
end
% disp(product);
a=2/(22/7); %2/pi
y=atan(product);
y=(t-y);%sigmoid function
e=t-y;%error
U=sum(e.^2);%mean square error
% disp(U)
% finding weight changes for a,b,d
for j=1:m
for i=1:(n-1)
derivativew(j,i)=a.*product(j)./((w(i)*x(j,i)+b(i))')*x(j,i);
derivativeb(j,i)=a.*product(j)./((w(i)*x(j,i)+b(i))');
end
end
M =[derivativew,derivativeb];
allparameters=[w,b]';
% updating weight changes for a,b,d
allparameters=allparameters-eta*M'*e';
w=allparameters(1:(n-1),1)';
b=allparameters((n):end,1)';
product=zeros(1,m);
for k=1:(n-1)
product=product.*(w(k)*x(:,k)+b(k))';
end
y=a.*atan(product);
e=t-y;
V=sum(e.^2);
disp('Error:')
disp(V)% displays the error terms
arr(z)=V;
plot(arr/m);
title('Error graph')
end
toc
% checking input data
product=ones(1,m);
for k=1:(n-1)
product=product.*(w(k)*x(:,k)+b(k))';
end
computed=a.*atan(product);
inputpatternst=[inputpatterns,computed'];
% disp('error');
e=t-computed;

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Neural Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by