How to change the number of inputs NN tool?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am new to MATLAB nntool. Can anyone please guide me how to change the number of inputs in the neural network tool because I want a neural network with 4 inputs,10 hidden layers and 1 output.
I have also created a neural network through coding but don't know how to attach it with the nntool.
0 Kommentare
Antworten (1)
Aditya
am 21 Aug. 2025
Hi Bhairvi,
If you want to use MATLAB’s nntool to create a neural network with 4 inputs, 10 hidden layers, and 1 output, you should know that nntool is mainly designed for simple networks and only supports a single hidden layer through its graphical interface. To specify 4 inputs and 1 output, you need to import your input and target data into nntool, making sure your input data matrix has 4 rows (for the 4 input features) and your target data has 1 row (for the output). When you create a new network in the GUI, you can set the number of input neurons and the number of neurons in the hidden layer, but not multiple hidden layers. If your goal is to build a network with 10 hidden layers, you’ll need to do this using MATLAB code, as the GUI does not support this level of customization. Unfortunately, you cannot import a network created via code into nntool for further editing or visualization; you have to use code for both creation and training if you require multiple hidden layers. However, you can still use nntool for data management and for creating simple networks.
Folllowing is the exapmle code :
% Assume inputData is a 4 x N matrix and targetData is a 1 x N matrix
% Create a feedforward network with 10 hidden layers, each with 10 neurons
hiddenLayerSizes = repmat(10, 1, 10); % [10 10 10 10 10 10 10 10 10 10]
net = feedforwardnet(hiddenLayerSizes);
% Configure the network with your data
net = configure(net, inputData, targetData);
% Train the network
net = train(net, inputData, targetData);
% Simulate the network with new data
output = net(inputData);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!