当前位置:网站首页>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 !
边栏推荐
- Get the source code in the mask with the help of shims
- You can see the employment prospects of PMP project management
- MySQL foundation 02 - installing MySQL in non docker version
- 26. Delete duplicates in the ordered array (fast and slow pointer de duplication)
- 2022-2028 global small batch batch batch furnace industry research and trend analysis report
- UML sequence diagram [easy to understand]
- If you can quickly generate a dictionary from two lists
- 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
- lolcat
- Summary of small program performance optimization practice
猜你喜欢
H5 audio tag custom style modification and adding playback control events
Web端自动化测试失败原因汇总
Opencv environment construction (I)
Svg image quoted from CodeChina
2022-2028 global small batch batch batch furnace industry research and trend analysis report
MySQL foundation 02 - installing MySQL in non docker version
Logstack configuration details -- elasticstack (elk) work notes 020
How to ensure the uniqueness of ID in distributed environment
mmclassification 标注文件生成
Hands on deep learning (34) -- sequence model
随机推荐
`Example of mask ` tool use
You can see the employment prospects of PMP project management
法向量点云旋转
Global and Chinese PCB function test scale analysis and development prospect planning report Ⓑ 2022 ~ 2027
Tkinter Huarong Road 4x4 tutorial II
pcl::fromROSMsg报警告Failed to find match for field ‘intensity‘.
Summary of small program performance optimization practice
Reading notes on how to connect the network - hubs, routers and routers (III)
Daughter love in lunch box
Report on the development trend and prospect trend of high purity zinc antimonide market in the world and China Ⓕ 2022 ~ 2027
Regular expression (I)
LeetCode 74. Search 2D matrix
PHP book borrowing management system, with complete functions, supports user foreground management and background management, and supports the latest version of PHP 7 x. Database mysql
《网络是怎么样连接的》读书笔记 - WEB服务端请求和响应(四)
After unplugging the network cable, does the original TCP connection still exist?
Investment analysis and future production and marketing demand forecast report of China's paper industry Ⓥ 2022 ~ 2028
品牌连锁店5G/4G无线组网方案
智慧路灯杆水库区安全监测应用
2022-2028 global seeder industry research and trend analysis report
Golang defer