# find the value/s of the membership function when a crisp value is given???

3 views (last 30 days)
Gadelhag M Omar Mohmed on 5 Feb 2019
Answered: Sam Chak on 20 Sep 2022
Hi everyone;
I am not that much dealing with Matlab so my knowledge on it is quite limited. I want to work on Long Shor-Term Memory network (lstmlayer) function in matlab that uses for time series classification problems. As I can understand from the given definition of this function, the input is a cell array type and the output is a categorical type. My data is a crisp value (please see the attached mat file) data which contains a numerical data represented as 5 columns. Each column from column one to four representing a feature as; (start time, end time, duration and activity count for each class(column 5)), the last column has the class (output ) that I am going to classify using the LSTM. I did convert it to cell array data for the inputs and categorical data representing the classes in the outputs and used it as inputs and outputs to the lstm and it is working perfectly.
What I am looking for now is to fuzzify these crisp values (in the inputs) and representing them using any of the MFs like "gaussmf" and then use these fuzzified values as an input to the lstm network. Hopefully, by that, I gave you the idea that I want to apply. Please accept my apologies for wasting your time.

Sam Chak on 20 Sep 2022
Hi @Gadelhag M Omar Mohmed, It might be a little late answering this.
But a data-driven Mamdani Fuzzy System can be generated using the Fuzzy Clustering Method (FCM).
The Gaussian membership functions (gaussmf) are used for each FIS input.
inputData = set5_v73(:, 1:4);
outputData = set5_v73(:, 5);
opt = genfisOptions('FCMClustering', 'FISType', 'mamdani');
fis = genfis(inputData, outputData, opt)
Iteration count = 1, obj. fcn = 157472.471121 Iteration count = 2, obj. fcn = 116043.324499 Iteration count = 3, obj. fcn = 103257.216462 Iteration count = 4, obj. fcn = 74286.012780 Iteration count = 5, obj. fcn = 42316.337039 Iteration count = 6, obj. fcn = 30912.483369 Iteration count = 7, obj. fcn = 22842.350019 Iteration count = 8, obj. fcn = 10819.232281 Iteration count = 9, obj. fcn = 8424.404455 Iteration count = 10, obj. fcn = 8256.121710 Iteration count = 11, obj. fcn = 8091.114189 Iteration count = 12, obj. fcn = 7985.259493 Iteration count = 13, obj. fcn = 7944.673590 Iteration count = 14, obj. fcn = 7922.418289 Iteration count = 15, obj. fcn = 7894.137043 Iteration count = 16, obj. fcn = 7846.677580 Iteration count = 17, obj. fcn = 7786.637470 Iteration count = 18, obj. fcn = 7747.018823 Iteration count = 19, obj. fcn = 7725.337083 Iteration count = 20, obj. fcn = 7707.933366 Iteration count = 21, obj. fcn = 7690.332424 Iteration count = 22, obj. fcn = 7671.331344 Iteration count = 23, obj. fcn = 7651.015348 Iteration count = 24, obj. fcn = 7630.114772 Iteration count = 25, obj. fcn = 7609.414216 Iteration count = 26, obj. fcn = 7589.150798 Iteration count = 27, obj. fcn = 7568.646365 Iteration count = 28, obj. fcn = 7546.245373 Iteration count = 29, obj. fcn = 7519.689536 Iteration count = 30, obj. fcn = 7487.783888 Iteration count = 31, obj. fcn = 7453.601524 Iteration count = 32, obj. fcn = 7424.010404 Iteration count = 33, obj. fcn = 7402.564985 Iteration count = 34, obj. fcn = 7387.715686 Iteration count = 35, obj. fcn = 7377.139635 Iteration count = 36, obj. fcn = 7369.449640 Iteration count = 37, obj. fcn = 7363.862772 Iteration count = 38, obj. fcn = 7359.849607 Iteration count = 39, obj. fcn = 7357.006426 Iteration count = 40, obj. fcn = 7355.018453 Iteration count = 41, obj. fcn = 7353.644538 Iteration count = 42, obj. fcn = 7352.704515 Iteration count = 43, obj. fcn = 7352.066860 Iteration count = 44, obj. fcn = 7351.637442 Iteration count = 45, obj. fcn = 7351.350003 Iteration count = 46, obj. fcn = 7351.158559 Iteration count = 47, obj. fcn = 7351.031566 Iteration count = 48, obj. fcn = 7350.947601 Iteration count = 49, obj. fcn = 7350.892226 Iteration count = 50, obj. fcn = 7350.855779 Iteration count = 51, obj. fcn = 7350.831825 Iteration count = 52, obj. fcn = 7350.816099 Iteration count = 53, obj. fcn = 7350.805783 Iteration count = 54, obj. fcn = 7350.799019 Iteration count = 55, obj. fcn = 7350.794585 Iteration count = 56, obj. fcn = 7350.791678 Iteration count = 57, obj. fcn = 7350.789772 Iteration count = 58, obj. fcn = 7350.788523 Iteration count = 59, obj. fcn = 7350.787703 Iteration count = 60, obj. fcn = 7350.787165 Iteration count = 61, obj. fcn = 7350.786812 Iteration count = 62, obj. fcn = 7350.786580 Iteration count = 63, obj. fcn = 7350.786427 Iteration count = 64, obj. fcn = 7350.786327 Iteration count = 65, obj. fcn = 7350.786261 Iteration count = 66, obj. fcn = 7350.786217 Iteration count = 67, obj. fcn = 7350.786188 Iteration count = 68, obj. fcn = 7350.786169 Iteration count = 69, obj. fcn = 7350.786157 Iteration count = 70, obj. fcn = 7350.786149
fis =
mamfis with properties: Name: "mamdani41" AndMethod: "min" OrMethod: "max" ImplicationMethod: "min" AggregationMethod: "max" DefuzzificationMethod: "centroid" DisableStructuralChecks: 0 Inputs: [1×4 fisvar] Outputs: [1×1 fisvar] Rules: [1×10 fisrule] See 'getTunableSettings' method for parameter optimization.
% Plotting Fuzzy Inputs
figure(1)
subplot(2,2,1)
plotmf(fis, 'input', 1)
subplot(2,2,2)
plotmf(fis, 'input', 2)
subplot(2,2,3)
plotmf(fis, 'input', 3)
subplot(2,2,4)
plotmf(fis, 'input', 4)
% Plotting Fuzzy Output
figure(2)
plotmf(fis, 'output', 1)

### Categories

Find more on Fuzzy Inference System Modeling 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!