Sequence oder Featureinput layer ?

2 ビュー (過去 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 Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by