Clear Filters
Clear Filters

Machine learning approach for tool wear prediction with more input values than output values

4 views (last 30 days)
So I have simulation data of 4 process parameters(input/predictors) with 2724 time steps. These values result in a single wear value (output/response).
As input data I have a [2714x4] matrix and output data [1x1] .
Similarly I have many single wear values which are a result of many values of Input.
Is there a machine learning approach which can train data with more input value per output value?
Thanks in advance.

Answers (1)

LeoAiE
LeoAiE on 10 May 2023
Yes, there is a machine learning approach to train your data with multiple input values per output value. In your case, you have multiple time steps of process parameters (predictors) that result in a single wear value (response). This can be treated as a regression problem.
A popular approach for this type of problem is using Recurrent Neural Networks (RNNs), specifically Long Short-Term Memory (LSTM) networks or Gated Recurrent Unit (GRU) networks. These networks are designed to handle time-series data and can learn patterns across different time steps.
Here's an example of how you can create an LSTM network using MATLAB and the Deep Learning Toolbox:
This code assumes you have already loaded your input data (2724x4 matrices) into a cell array named inputData and your output data (single wear values) into a row vector named outputData. The code then processes the data, creates an LSTM network, trains it, and makes predictions.
% Assuming inputData is a cell array where each cell contains a 2724x4 matrix
inputData = cat(3, inputData{:});
% Assuming outputData is a row vector
outputData = outputData';
% Split data into training and validation sets
trainRatio = 0.8;
numTrain = round(size(inputData, 3) * trainRatio);
trainInputData = inputData(:, :, 1:numTrain);
trainOutputData = outputData(1:numTrain);
valInputData = inputData(:, :, numTrain+1:end);
valOutputData = outputData(numTrain+1:end);
% Create LSTM network
numHiddenUnits = 100;
layers = [ ...
sequenceInputLayer(4)
lstmLayer(numHiddenUnits)
fullyConnectedLayer(1)
regressionLayer];
% Set up training options
options = trainingOptions('adam', ...
'MaxEpochs', 100, ...
'GradientThreshold', 1, ...
'InitialLearnRate', 0.005, ...
'LearnRateSchedule', 'piecewise', ...
'LearnRateDropPeriod', 125, ...
'LearnRateDropFactor', 0.2, ...
'ValidationData', {valInputData, valOutputData}, ...
'Verbose', 1, ...
'Plots', 'training-progress');
% Train the network
net = trainNetwork(trainInputData, trainOutputData, layers, options);
% Predict wear values
predictedOutputData = predict(net, inputData);
  2 Comments
Chethan Kumar Kusta
Chethan Kumar Kusta on 10 May 2023
Thank you for your answer.
But I still get the error- Sequence responses must have the same sequence length as the
corresponding predictors. Because the sequence length of response is 1 and sequence length of predictor is 2724.
LeoAiE
LeoAiE on 11 May 2023
It's hard to help you without the data so most of the answers are just guessing! It seems there is a misunderstanding about the sequence length. Based on your problem description, it appears that you have a single output for a single set of 2724 input values, which would make this a standard supervised learning problem rather than a sequence-to-sequence problem. In this case, you should use a standard regression model instead of an LSTM.
Also the codes here are examples so you have to adjust accordingly to fit your needs
% Replace this with your actual data
X = rand(100, 2724); % 100 samples, each with 2724 input values
y = rand(100, 1); % 100 output values
% Split the data (80% for training and 20% for testing)
split_ratio = 0.8;
num_samples = size(X, 1);
num_train_samples = round(num_samples * split_ratio);
% Shuffle the data
rng('default'); % For reproducibility
shuffled_indices = randperm(num_samples);
X_shuffled = X(shuffled_indices, :);
y_shuffled = y(shuffled_indices);
% Split the data
X_train = X_shuffled(1:num_train_samples, :);
y_train = y_shuffled(1:num_train_samples);
X_test = X_shuffled(num_train_samples+1:end, :);
y_test = y_shuffled(num_train_samples+1:end);
% Train a linear regression model
mdl = fitlm(X_train, y_train);
% Test the model
y_pred = predict(mdl, X_test);
% Calculate the mean squared error
mse = mean((y_pred - y_test).^2);
disp(['Mean squared error: ', num2str(mse)]);

Sign in to comment.

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!