Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

PROJECT REPORT

“ Kohonen Self organizing map ”

Submitted for CAL in B.Tech Neural Networks and Fuzzy Logic (EEE1007)

Submitted by

Abhilash Pani (15BEE1030)


Akash Singh (15BEE1048)
Vaibhav (15BEE1147)

Slot: E1

Name of faculty: DEEPA T.

(SCHOOL OF ELECTRICAL ENGINEERING)

April 2017

i
CERTIFICATE

This is to certify that the Project work entitled “Kohonen Self organizing map” that is
being submitted by “Abhilash Pani, Akash Singh and Vaibhav” for CAL in B.Tech
Neural Networks and Fuzzy Logic (EEE1007) is a record of bonafide work done under
our supervision. The contents of this Project work have not been submitted for any other
CAL course.

Place : Chennai

Date : May2nd, 2017

Signature of students:

Abhilash Pani

Akash Singh

Vaibhav

Signature of Faculty: DEEPA T.

ii
CONTENTS

ACKNOWLEDGEMENTS………………………………………………………...iv

ABSTRACT………………………………………………………………………iv

1. Introduction………………………………………………….......................v

2. Conclusion and applications……..................................................................xi

3. References...................................................................................................xi

ACKNOWLEDGEMENTS
ACKNOWLEDGEMENTS

iii
ACKNOWLEDGEMENTS

It is our duty to thank the faculty of SELECT, Dr Angalaeswari, for giving us valuable
inputs and most importantly our faculty, Ms Deepa T, for her invaluable guidance and
support throughout the entire semester and giving us this opportunity to make this project
possible

Abhilash Pani

Registration number 15BEE1030

Akash Singh

Registration number 15BEE1048

Vaibhav

Registration number 15BEE1147

iv
ABSTRACT

This project report is a detailed explanation about the idea that went into building the
code for Kohonen self-organizing map. The code, built to be used in MATLAB, works to
different parts of he network to respond similarly to certain input patterns. It has been
programmed in such a way that it can present the result almost immediately.

The aim here is to analyze the use of Artificial Neural Network in clinical and diagnostic
approaches through selected examples.

The use of neural network in diagnosing fever, through definite medical example,
showing the output state.

Segmentation of Brain Tumor from Magnetic Resonance Images, using Kohonen Model
of Artificial Neural Network.

MATLAB code for analyzing non-morphological distinction between glomerular and


tubular renal disease, using Kohonen Model and obtaining definite state of result.

v
1. Introduction
What is a Self organizing map?

A self-organizing map (SOM) or self-organizing feature map (SOFM)


is a type of artificial neural network (ANN) that is trained using
unsupervised learning to produce a low-dimensional (typically two-
dimensional), discretized representation of the input space of the
training samples, called a map, and is therefore a method to do
dimensionality reduction.
A self-organizing map consists of components called nodes or
neurons. Associated with each node are a weight vector of the same
dimension as the input data vectors, and a position in the map space.
The usual arrangement of nodes is a two-dimensional regular spacing
in a hexagonal or rectangular grid. The self-organizing map describes
a mapping from a higher-dimensional input space to a lower-
dimensional map space. The procedure for placing a vector from data
space onto the map is to find the node with the closest (smallest
distance metric) weight vector to the data space vector.
While it is typical to consider this type of network structure as related
to feedforward networks where the nodes are visualized as being
attached.
The goal of learning in the self-organizing map is to cause different
parts of the network to respond similarly to certain input patterns. This
is partly motivated by how visual, auditory or other sensory

vi
information is handled in separate parts of the cerebral cortex in the
human brain.
The weights of the neurons are initialized either to small random
values or sampled evenly from the subspace spanned by the two
largest principal component eigenvectors. With the latter alternative,
learning is much faster because the initial weights already give a good
approximation of SOM weights.
The network must be fed a large number of example vectors that
represent, as close as possible, the kinds of vectors expected during
mapping. The examples are usually administered several times as
iterations.
The training utilizes competitive learning. When a training example is
fed to the network, its Euclidean distance to all weight vectors is
computed. The neuron whose weight vector is most similar to the
input is called the best matching unit (BMU). The weights of the
BMU and neurons close to it in the SOM lattice are adjusted towards
the input vector. The magnitude of the change decreases with time and
with distance (within the lattice) from the BMU.

Neural Networks in Medical Sciences

Diagnosing Fever:

The rescaled temperature for patients are noted and targets are found using
threshold.
Using Gradient descent method along with Logistic function and delta rule
for updation of weights.
Random values for weights, and bias are initialized along with learning rate.
Output is obtained using logistic activation function.
Square error is calculated, weights are updated using Delta rule.
The iteration or epoch is done until the square error is zero.

Locating the brain tumor using Kohonen model

Contrast enhancement, for proper segmentation, the intensity is varied to


distinguish healthy parts of brain.
Cranium Removal, the bones around the brain mass is removed.

Analyzing Renal diseases using Kohonen model by MATLAB.

vii
Random input and weights are initialized.
Squared Euclidian distance is calculated, winning cluster is found out by
comparing for minimum distance.
Updating the weight matrix, and iterating for the given number.
After the iteration is over displaying the output, using drawnow command
for flushing the input every time.

The Code
% Self organizing map Kohonen
clc
clear all
close all
for i=1:1000
Input_1(i)=rand;%Inputs been given randomly
Input_2(i)=rand;%Inputs been given randomly
end
display(Input_1)
display(Input_2)
for j1=1:10
for j2=1:10
Weight_1(j1,j2)=rand*0.04+0.6;%weights have been given
randomly
Weight_2(j1,j2)=rand*0.04+0.6;%weights have been given
randomly
end
end
%display(Weight_1)
%display(Weight_2)
figure(1)
plot(Input_1,Input_2,'.b')
hold on
plot(Weight_1,Weight_2,'or')
plot(Weight_1,Weight_2,'k','linewidth',2)
plot(Weight_1',Weight_2','k','linewidth',2)
hold off
title('t=0');
drawnow;%MATLAB command for flushing the input everytime at output
screen.
no=1;
do=5;
T=10;%number of iteration for self-organising
t=1;
while (t<=T)
n=no*(1-t/T);%for making learning rate decrease with according

viii
to 10*10 matrix
%display(n)
d=round(do*(1-t/T));
%display(d)
%loop for the 1000 inputs
for i=1:1000
Euclidean_distance=(Input_1(i)-Weight_1).^2+(Input_2(i)-
Weight_2).^2;%minimum distance stored
%display(Euclidean_distance)
minj1=1;
minj2=1;
min_norm=Euclidean_distance(minj1,minj2);%initialisig the
first 1 x 1 matrix as minimum for reference
%display(min_norm)
for j1=1:10
for j2=1:10
if Euclidean_distance(j1,j2)<min_norm
min_norm=Euclidean_distance(j1,j2);%swapping the
values for minimum
minj1=j1;%taking the minimum position( may be
first column)
minj2=j2;%taking the minimum position(may be
second is row)
end
end
end
min_position_1= minj1;%assigning the minimum element
position
min_position_2= minj2;%assigning the minimum element
position
%display(min_position_1 )
%display(min_position_2)
%update the winning neuron

Weight_1(min_position_1,min_position_2)=Weight_1(min_position_1,min_
position_2)+n*(Input_1(i)- Weight_1(min_position_1,min_position_2));

Weight_2(min_position_1,min_position_2)=Weight_2(min_position_1,min_
position_2)+n*(Input_2(i)- Weight_2(min_position_1,min_position_2));

%update the neighbour neurons

for dd=1:1:d% for 3-d plotting


%display(dd)
min_pos_1=min_position_1-dd;%vertically updating
min_pos_2=min_position_2;
if (min_pos_1>=1)

Weight_1(min_pos_1,min_pos_2)=Weight_1(min_pos_1,min_pos_2)+n*(Input
_1(i)-Weight_1(min_pos_1,min_pos_2));

Weight_2(min_pos_1,min_pos_2)=Weight_2(min_pos_1,min_pos_2)+n*(Input
_2(i)-Weight_2(min_pos_1,min_pos_2));
end
min_pos_1=min_position_1+dd;%vertically updating
min_pos_2=min_position_2;

ix
if (min_pos_1<=10)

Weight_1(min_pos_1,min_pos_2)=Weight_1(min_pos_1,min_pos_2)+n*(Input
_1(i)-Weight_1(min_pos_1,min_pos_2));

Weight_2(min_pos_1,min_pos_2)=Weight_2(min_pos_1,min_pos_2)+n*(Input
_2(i)-Weight_2(min_pos_1,min_pos_2));
end
min_pos_1=min_position_1;
min_pos_2=min_position_2-dd; %horizontally updating
if (min_pos_2>=1)

Weight_1(min_pos_1,min_pos_2)=Weight_1(min_pos_1,min_pos_2)+n*(Input
_1(i)-Weight_1(min_pos_1,min_pos_2));

Weight_2(min_pos_1,min_pos_2)=Weight_2(min_pos_1,min_pos_2)+n*(Input
_2(i)-Weight_2(min_pos_1,min_pos_2));
end
min_pos_1=min_position_1;
min_pos_2=min_position_2+dd;%horizontally updating
if (min_pos_2<=10)

Weight_1(min_pos_1,min_pos_2)=Weight_1(min_pos_1,min_pos_2)+n*(Input
_1(i)-Weight_1(min_pos_1,min_pos_2));

Weight_2(min_pos_1,min_pos_2)=Weight_2(min_pos_1,min_pos_2)+n*(Input
_2(i)-Weight_2(min_pos_1,min_pos_2));
end
end
end

t=t+1;
figure(1)
plot(Input_1,Input_2,'.b')
hold on
plot(Weight_1,Weight_2,'or')
plot(Weight_1,Weight_2,'k','linewidth',2)
plot(Weight_1',Weight_2','k','linewidth',2)
hold off
title(['t=' num2str(t)]);
drawnow;
pause(1)

end

x
xi
2. Conclusion
Self organizing map is one of the most challenging and advanced technology with
many application in the field of Science and Research and is being used for many
medical purposes. The reason for choosing Kohonen Algorithm is to learn the
practical aspect of what is being taught in the classroom as it is a part of the
syllabus. One of the main application of this program is to detect tumor in Human
brain.
We conclude that a Kohonen model is capable of classifying the patients as
having glomerular or tubular disease with a high sensitivity and predictive value.
The rule-based system does not perform well than the
neural networks. The most adequate results were obtained with the hybrid system.
Artificial Neural Network models can be used to analyze and predict results much
faster for clinical purposes, as it can completely mimic human brain. When
Network is trained well it can replace many human functions.

xii
3. References
 www.mathworks.com
 https://www.youtube.com/watch?v=RqAa8Uu9zbQ
 https://en.wikipedia.org/wiki/Self-organizing_map#Applications

xiii

You might also like