Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize the Classification of Neural Network by matlab

Shulou Source: shulou.com Published: 2022-06-01 03:19:33 10月03日 Update

This article Xiaobian for you to introduce in detail "matlab how to achieve neural network classification", the content is detailed, the steps are clear, the details are handled properly, I hope that this "matlab how to achieve neural network classification" article can help you solve your doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.

% clear environment variables

Clear

Clc

%% training set / test set generation

% Import data

Load water_data.mat

% data normalization

Attributes = mapminmax (attributes)

% 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)

%% competitive neural network creation, training and simulation testing

% create a network

Net = competlayer (4)

% set training parameters

Net.trainParam.epochs = 500,

% training network

Net = train (net,P_train)

% 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)

%% SOFM neural network creation, training and simulation testing

% create a network

Net = selforgmap ([4 4])

% set training parameters

Net.trainParam.epochs = 200

% training network

Net = train (net,P_train)

% 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)

%% distribution of network neurons

View Network Topology structure

Figure

Plotsomtop (net)

% to view the direct distance of neighboring neurons

Figure

Plotsomnd (net)

% View the classification of each neuron

Figure

Plotsomhits (net,P_train)

%% result comparison

% competitive neural network

Result_compet_1 = [Troubles' Tubes simplex TV1']

Result_compet_2 = [Thumtest`This simplex examples are tantalized 2']

% SOFM neural network

Result_sofm_1 = [Troubles' Tubes simplex softplaces 1']

Result_sofm_2 = [Tempest 'Tunable simplex softfloor 2']

After reading this, the article "how to classify neural networks in matlab" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.

Tags: Networks neural training testing neural networks classification simulation situation articles neurons content parameters data samples competition appropriateness variables ideas topology topology Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Apple Microsoft Redmi Shulou Technology