- Combine your input data ("rotational speed", torque, time) into a single matrix where each row represents a different operating point and ensure your target data (temperature) is in a corresponding vector.
- Use a standard feedforward neural network with input and output layers designed for regression and use the "train" function instead of "trainnet".
Sequence oder Featureinput layer ?
2 views (last 30 days)
Show older comments
Hello dear Community,
i am currently trying to use a Feed-Forward Neural Network for a regression problem.
The input data i want to feed in are "rotational speed", "torque" and "time".
The target data is the temperature of an electrical drive.
And then i will have different operating points dependend on speed:
2000 rpm, 4000 rpm ....
The torque and time however stays the same for each point.
Right now, i am using a sequenceInputLayer and arranged the Data in 4 cells, where each cell contains 3 columns of data. One cell represents one OP.
The results are not good, and my gut tells me, that i might have a misunderstanding the way i treat the input data.
I am using MATLAB r24a and am training the network with the "trainnet"-function.
If you have any Suggestions to do this in a different way, go ahead.
Thank you very much in advance.
0 Comments
Answers (1)
Abhas
on 9 Aug 2024
Hi Tobias,
Instead of using a "sequenceInputLayer", you can use a standard "feedforwardnet" in MATLAB. You can follow the below steps to restructure your approach:
Here's is a sample example MATLAB code to demonstrate the same:
% Example Data
% Assuming you have 10 operating points
rotational_speed = [2000, 4000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000]; % Your actual data here
torque = repmat(50, 1, 10); % Example constant torque
time = repmat(10, 1, 10); % Example constant time
temperature = [70, 75, 80, 85, 90, 95, 100, 105, 110, 115]; % Your target temperature data
% Combine inputs into a matrix (each row is a feature, each column is a sample)
inputs = [rotational_speed; torque; time];
% Target data
targets = temperature;
% Create a Feed-Forward Neural Network
hiddenLayerSize = 10; % Adjust as needed
net = feedforwardnet(hiddenLayerSize);
% Train the Network
[net, tr] = train(net, inputs, targets);
% View the Network
view(net);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets, outputs);
performance = perform(net, targets, outputs);
% Display Results
disp('Performance:');
disp(performance);
You may refer to the attached output images and also the following MathWorks documentation links to have a better understanding on "feedforwardnet" and "train" functions:
2 Comments
Abhas
on 9 Aug 2024
In that case, "dlnetwork" might be helpful for you. You may refer to the below documentation links and try to incorporate them:
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!