Sequence oder Featureinput layer ?

조회 수: 1 (최근 30일)
tobias
tobias 2024년 8월 9일
댓글: Abhas 2024년 8월 9일
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.

답변 (1개)

Abhas
Abhas 2024년 8월 9일
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:
  • 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".
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:
  1. feedforwardnet: https://www.mathworks.com/help/deeplearning/ref/feedforwardnet.html
  2. train: https://www.mathworks.com/help/deeplearning/ref/train.html
  댓글 수: 2
tobias
tobias 2024년 8월 9일
Thank you for the fast reply.
Unfortunately, i can not use the feedforwardnet function, since i do have a custom layer in my architecture.
Abhas
Abhas 2024년 8월 9일
In that case, "dlnetwork" might be helpful for you. You may refer to the below documentation links and try to incorporate them:
  1. https://www.mathworks.com/help/deeplearning/ref/dlnetwork.html
  2. https://www.mathworks.com/help/deeplearning/ug/define-custom-deep-learning-layers.html

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by