Developing a neural network using data from a one column matrix containing 6606 entries

12 次查看(过去 30 天)
I am creating a neural network, but I am unsure how to train my network using the one column matrix. How would I approach this?

回答(1 个)

Ayush Anand
Ayush Anand 2023-11-21
Hi Jorge,
I understand that you have a one column matrix, and you want to know how to train a neural network on the same. Neural networks usually take inputs in the form of a N*M matrix, where the number of rows N is the number of data samples we have with us and M is the number of features we have for each sample.
If you have just one column, this means the data you have just one feature, or in other words its simply the data values available to us. You can train a neural network on this in the exact same way as you would on an input data of any shape, and MATLAB will treat it the same way. Here is an example to show how it works:
x= rand (1,6606) * pi/2 ; %Generate 6606 random values between 0 and pi/2
y=sin(x); %This is the target function
net=feedforwardnet (); %Defining the neural network; we can specify the number of hidden layers we want in the arguments
net = train(net, x, y); %Training the model
predictedOutput= net([pi/2]); %Making predictions on a sample
In the above example, a matrix containing just one column of 6606 random numbers (similar to the case you have) between 0 and pi/2 is passed to the neural network as the input layer. The neural network uses this to train and fit the given target vector and produces an output which resembles the sine function when used for predictions.
You can read more about neural networks here:
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by