当前位置:网站首页>Matlab tips (25) competitive neural network and SOM neural network
Matlab tips (25) competitive neural network and SOM neural network
2022-07-04 09:38:00 【mozun2020】
MATLAB Tips (25) Competitive neural network and SOM neural network
Preface
MATLAB Learning about image processing is very friendly , You can start from scratch , There are many encapsulated functions that can be called directly for basic image processing , This series of articles is mainly to introduce some of you in MATLAB Some concept functions are commonly used in routine demonstration !
Competitive neural network is based on unsupervised learning (Unsupervised learning) Method is an important type of neural network , It is often used as a basic form of network , Form other self-organizing networks , Such as self-organizing mapping network (SOM)、 Adaptive resonance theory network 、 Learning vector quantization network .
Self organizing maps (Self-organizing map, SOM) By learning to input data in space , Generate a low dimension 、 Discrete mapping (Map), To some extent, it can also be regarded as a dimension reduction algorithm .SOM It is an unsupervised artificial neural network . Different from the general neural network, it is trained based on the reverse transfer of loss function , It uses competitive learning (competitive learning) Strategy , Rely on the competition between neurons to gradually optimize the network . And use the nearest neighbor function (neighborhood function) To maintain the topology of the input space . Maintain the topology of the input space : signify Two dimensional mapping includes the relative distance between data points . Adjacent samples in the input space are mapped to adjacent output neurons .
Due to unsupervised learning , This means that there is no need for human intervention in the training stage ( That is, no sample label is required ), That is, without knowing the category , Clustering the data ; You can identify features that are intrinsically related to a problem . Competitive neural network and SOM A simulation example of neural network prediction, analysis and comparison is shared with you ,MATLAB Version is MATLAB2015b.
One . MATLAB Simulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function : Competitive neural network and SOM neural network
% Environmental Science :Win7,Matlab2015b
%Modi: C.S
% Time :2022-06-27
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% I. Clear environment variables
clear all
clc
tic
%% II. Training set / Test set generation
%%
% 1. Import data
load water_data.mat
%%
% 2. Data normalization
attributes = mapminmax(attributes);
%%
% 3. Division of training set and test set
% Training set ——35 Samples
P_train = attributes(:,1:35);
T_train = classes(:,1:35);
% Test set ——4 Samples
P_test = attributes(:,36:end);
T_test = classes(:,36:end);
%% III. Creation of competitive neural network 、 Training and simulation testing
%%
% 1. Creating networks
net = newc(minmax(P_train),4,0.01,0.01);
%%
% 2. Set training parameters
net.trainParam.epochs = 500;
%%
% 3. Training network
net = train(net,P_train);
%%
% 4. The simulation test
% Training set
t_sim_compet_1 = sim(net,P_train);
T_sim_compet_1 = vec2ind(t_sim_compet_1);
% Test set
t_sim_compet_2 = sim(net,P_test);
T_sim_compet_2 = vec2ind(t_sim_compet_2);
%% IV. SOFM Neural networks create 、 Training and simulation testing
%%
% 1. Creating networks
net = newsom(P_train,[4 4]);
%%
% 2. Set training parameters
net.trainParam.epochs = 200;
%%
% 3. Training network
net = train(net,P_train);
%%
% 4. The simulation test
% Training set
t_sim_sofm_1 = sim(net,P_train);
T_sim_sofm_1 = vec2ind(t_sim_sofm_1);
% Test set
t_sim_sofm_2 = sim(net,P_test);
T_sim_sofm_2 = vec2ind(t_sim_sofm_2);
%% V. Results contrast
%%
% 1. Competitive neural network
result_compet_1 = [T_train' T_sim_compet_1']
result_compet_2 = [T_test' T_sim_compet_2']
%%
% 2. SOFM neural network
result_sofm_1 = [T_train' T_sim_sofm_1']
result_sofm_2 = [T_test' T_sim_sofm_2']
toc
Two . Simulation results
result_compet_1 =
1 1
1 4
1 2
1 1
1 1
1 2
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 1
2 1
2 4
2 4
3 3
3 3
3 3
3 3
3 3
3 3
3 3
3 3
3 3
4 2
4 2
4 2
4 2
4 1
4 1
4 1
4 1
result_compet_2 =
1 4
2 4
3 3
4 2
result_sofm_1 =
1 9
1 11
1 12
1 9
1 4
1 12
2 10
2 10
2 10
2 10
2 10
2 10
2 13
2 10
2 9
2 9
2 14
2 10
3 3
3 5
3 1
3 1
3 1
3 2
3 1
3 2
3 1
4 15
4 12
4 16
4 15
4 7
4 7
4 8
4 8
result_sofm_2 =
1 11
2 10
3 1
4 15
Time has passed 10.817151 second .
In turn, click Plots Medium SOM Topology,SOM Neighbor Connections,SOM Neighbor Distances,SOM Input Planes,SOM Sample Hits,SOM Weight Positions The following simulation diagram can be obtained :
3、 ... and . Summary
Competitive neural network and SOM Neural networks train , Example simulation of predictive analysis , In fact, in my own column 《MATLAB neural network 43 A case study 》 These two kinds of neural networks are also introduced in , Interested students can also move to the column , Link at the end of the article . Learn one every day MATLAB Little knowledge , Let's learn and make progress together !
边栏推荐
- Pueue data migration from '0.4.0' to '0.5.0' versions
- How web pages interact with applets
- C # use gdi+ to add text to the picture and make the text adaptive to the rectangular area
- Leetcode (Sword finger offer) - 35 Replication of complex linked list
- Reading notes on how to connect the network - hubs, routers and routers (III)
- You can see the employment prospects of PMP project management
- Global and Chinese market of wheel hubs 2022-2028: Research Report on technology, participants, trends, market size and share
- Development trend and market demand analysis report of high purity tin chloride in the world and China Ⓔ 2022 ~ 2027
- Write a jison parser from scratch (3/10): a good beginning is half the success -- "politics" (Aristotle)
- 自动化的优点有哪些?
猜你喜欢
自动化的优点有哪些?
Hands on deep learning (32) -- fully connected convolutional neural network FCN
技术管理进阶——如何设计并跟进不同层级同学的绩效
Jianzhi offer 09 realizes queue with two stacks
PHP is used to add, modify and delete movie information, which is divided into foreground management and background management. Foreground users can browse information and post messages, and backgroun
C # use gdi+ to add text with center rotation (arbitrary angle)
Sort out the power node, Mr. Wang he's SSM integration steps
Some points needing attention in PMP learning
2022-2028 global optical transparency industry research and trend analysis report
回复评论的sql
随机推荐
Daughter love: frequency spectrum analysis of a piece of music
Function comparison between cs5261 and ag9310 demoboard test board | cost advantage of cs5261 replacing ange ag9310
Daughter love in lunch box
H5 audio tag custom style modification and adding playback control events
JDBC and MySQL database
LeetCode 74. Search 2D matrix
Trim leading or trailing characters from strings- Trim leading or trailing characters from a string?
Trees and graphs (traversal)
Summary of small program performance optimization practice
Four common methods of copying object attributes (summarize the highest efficiency)
Global and Chinese market of bipolar generators 2022-2028: Research Report on technology, participants, trends, market size and share
2022-2028 global elastic strain sensor industry research and trend analysis report
Reading notes on how to connect the network - hubs, routers and routers (III)
Global and Chinese markets for laser assisted liposuction (LAL) devices 2022-2028: Research Report on technology, participants, trends, market size and share
At the age of 30, I changed to Hongmeng with a high salary because I did these three things
C # use ffmpeg for audio transcoding
华为联机对战如何提升玩家匹配成功几率
Sort out the power node, Mr. Wang he's SSM integration steps
Write a jison parser from scratch (1/10):jison, not JSON
The 14th five year plan and investment risk analysis report of China's hydrogen fluoride industry 2022 ~ 2028