当前位置:网站首页>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 !
边栏推荐
- Analysis report on the development status and investment planning of China's modular power supply industry Ⓠ 2022 ~ 2028
- Four common methods of copying object attributes (summarize the highest efficiency)
- What is permission? What is a role? What are users?
- Leetcode (Sword finger offer) - 35 Replication of complex linked list
- Development trend and market demand analysis report of high purity tin chloride in the world and China Ⓔ 2022 ~ 2027
- Ultimate bug finding method - two points
- DR6018-CP01-wifi6-Qualcomm-IPQ6010-IPQ6018-FAMILY-2T2R-2.5G-ETH-port-CP01-802-11AX-MU-MIMO-OFDMA
- Flutter 小技巧之 ListView 和 PageView 的各种花式嵌套
- Launpad | 基础知识
- 浅谈Multus CNI
猜你喜欢
How does idea withdraw code from remote push
Nuxt reports an error: render function or template not defined in component: anonymous
技术管理进阶——如何设计并跟进不同层级同学的绩效
2022-2028 global seeder industry research and trend analysis report
C # use gdi+ to add text with center rotation (arbitrary angle)
GoLand environment variable configuration
2022-2028 global probiotics industry research and trend analysis report
How do microservices aggregate API documents? This wave of show~
2022-2028 global protein confectionery industry research and trend analysis report
Summary of small program performance optimization practice
随机推荐
AMLOGIC gsensor debugging
2022-2028 research and trend analysis report on the global edible essence industry
Launpad | 基礎知識
IIS configure FTP website
2022-2028 global visual quality analyzer industry research and trend analysis report
2022-2028 global optical transparency industry research and trend analysis report
Report on the development trend and prospect trend of high purity zinc antimonide market in the world and China Ⓕ 2022 ~ 2027
Write a mobile date selector component by yourself
Launpad | Basics
Hands on deep learning (33) -- style transfer
直方图均衡化
Dynamic analysis and development prospect prediction report of high purity manganese dioxide in the world and China Ⓡ 2022 ~ 2027
MySQL foundation 02 - installing MySQL in non docker version
Write a jison parser from scratch (1/10):jison, not JSON
法向量点云旋转
Get the source code in the mask with the help of shims
2022-2028 global probiotics industry research and trend analysis report
Problems encountered by scan, scanf and scanln in golang
How does idea withdraw code from remote push
Explanation of for loop in golang