当前位置:网站首页>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 !
边栏推荐
- DR6018-CP01-wifi6-Qualcomm-IPQ6010-IPQ6018-FAMILY-2T2R-2.5G-ETH-port-CP01-802-11AX-MU-MIMO-OFDMA
- Some points needing attention in PMP learning
- Fatal error in golang: concurrent map writes
- Investment analysis and prospect prediction report of global and Chinese high purity tin oxide Market Ⓞ 2022 ~ 2027
- Ultimate bug finding method - two points
- Write a jison parser from scratch (2/10): learn the correct posture of the parser generator parser generator
- Go context 基本介绍
- Hands on deep learning (34) -- sequence model
- 2022-2028 global gasket plate heat exchanger industry research and trend analysis report
- Write a jison parser from scratch (3/10): a good beginning is half the success -- "politics" (Aristotle)
猜你喜欢

2022-2028 global optical transparency industry research and trend analysis report

Opencv environment construction (I)

品牌连锁店5G/4G无线组网方案
自动化的优点有哪些?

2022-2028 global visual quality analyzer industry research and trend analysis report

GoLand environment variable configuration

2022-2028 global gasket metal plate heat exchanger industry research and trend analysis report

JDBC and MySQL database

165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version

HMS core helps baby bus show high-quality children's digital content to global developers
随机推荐
Global and Chinese markets of thrombography hemostasis analyzer (TEG) 2022-2028: Research Report on technology, participants, trends, market size and share
智慧路灯杆水库区安全监测应用
Research Report on the development trend and Prospect of global and Chinese zinc antimonide market Ⓚ 2022 ~ 2027
Rules for using init in golang
Problems encountered by scan, scanf and scanln in golang
HMS core helps baby bus show high-quality children's digital content to global developers
2022-2028 global industry research and trend analysis report on anterior segment and fundus OTC detectors
直方图均衡化
Kubernetes CNI 插件之Fabric
Go context 基本介绍
自动化的优点有哪些?
C语言指针经典面试题——第一弹
Ultimate bug finding method - two points
Daughter love in lunch box
Write a jison parser (7/10) from scratch: the iterative development process of the parser generator 'parser generator'
什么是uid?什么是Auth?什么是验证器?
Solution to null JSON after serialization in golang
Log cannot be recorded after log4net is deployed to the server
Write a jison parser from scratch (5/10): a brief introduction to the working principle of jison parser syntax
Lauchpad x | MODE