- Cross-Validation: Consider using k-fold cross-validation to ensure that your model generalizes well to unseen data.
- Model Evaluation: Evaluate the performance of your ANFIS model using metrics such as RMSE, R-squared, etc., to ensure it is improving the data quality.
Is it possible to obtain ANFIS Data for Genetic Algorithm Optimisation in MATLAB?
8 views (last 30 days)
Show older comments
I use Design Expert to generate regression equations from raw input data. These regression equations are integrated into MATLAB to perform genetic algorithm single and multi-objective optimisation using the MATLAB optimisation tool. I've been looking to utilise ANFIS using the MATLAB fuzzy logic designer to fine tune the raw data, so that the fine tuned input data and output data can be used for the optimisation instead.
However, the exports I get from the ANFIS simulation results are not (in my opinion) very clear regarding how I can use these fine-tuned datasets subsequent to training the model and obtaining the Root mean square errors. How can one determine the fine tuned input and output data after the training is complete? I see that the training model generates ranges for each of my membership functions per input but from that range, it is difficult to ascertain whether it can give me a specific dataset of values for input and output compared to the raw input and output data that was entered.
The steps I have performed thus far:
- I used 85% (26) of the total data set (30) to train the Sugeno model
- I used the remaining 15% (4) of the total data set to validate, from which I got tuned predictions of the 4 reference outputs.
- From my observation, System Validation takes the trained model and gives 'tuned' predicted values of any dataset that is used for validation
- In this regard, it is my assumption that by inputting the full 30 reference data sets would give me tuned versions of themselves as tuned output values, which I can re-inject into Design Expert to obtain a 'tuned' regression equation, to be used for MATLAB's genetic algorithm optimisation.
- After trying this, I did get higher R squared values for the regression equation as well, which "kind" of confirmed that this works. However, I have not seen this be done anywhere, nor do I know if my interpretation of how to use the system validation via the fuzzy logic designer to get these tuned outputs is correct.
I've also attached a code script that was formulated without the use of the Fuzzy Logic Designer tool to try and ascertain the problem. The 'idea' centres around re-integrating the 30 datasets into the validation step this time (even though 26 of them were used to train in the first place), but for the purpose of obtaining tuned versions of themselves before using the tuned versions in Design Expert for generating a 'tuned' regression equation for MATLAB's GA Optimisation. Does this make sense?
I am unsure if these are the right steps. Any advice would be greatly appreciated.
% Load your data
load yourData.mat % Replace with your data file
% Combine inputs and outputs into one dataset
data = [inputs, outputs];
% Split data into training and validation sets
numDataPoints = size(data, 1);
trainRatio = 0.85; % 15% for training
numTrain = round(trainRatio * numDataPoints);
trainData = data(1:numTrain, :);
valData = data(numTrain+1:end, :);
% Generate initial FIS using genfis1
numMFs = 4; % Example number of membership functions
fis = genfis1(trainData, numMFs);
% Train the ANFIS model with validation data
[anfisModel, trainError, stepSize, valError] = anfis(trainData, fis, [], [], valData);
% Display the final model structure
disp(anfisModel);
% Assume 'newInputs' is the data for which you want to predict the outputs
newInputs = inputs; % Replace with your actual new input data
% Evaluate the model to get the fine-tuned outputs
fineTunedOutputs = evalfis(newInputs, anfisModel);
% Display the fine-tuned outputs
disp(fineTunedOutputs);
0 Comments
Answers (1)
Karan Singh
on 18 Jul 2024
I belive you are on a right track, considering the training data split for validation and also the concept of tuned outputs. This feels like a good start point. from my side I can suggest a few more metrics that you can consider while moving forward with your appocah.
0 Comments
See Also
Categories
Find more on Fuzzy Logic Toolbox 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!