how to implement fuzzy-KNN code to fault detection

16 visualizaciones (últimos 30 días)
merlin toche
merlin toche el 15 de Feb. de 2023
Respondida: Shubham el 5 de Nov. de 2024 a las 15:45
Hi everybody!
please, I come to you once again to seek clarification.
indeed, I want to use the fuzzy-KNN algorithm to detect in a system. I have five categories of defects to detect, namely [No, O, S, PS, SD] corresponding to the values [1 2 3 4 5]
I wrote my algorithm and on this basis I tried a code that I find not correct,
I request your help to solve my problem please. if you can reread and bring your point of view, I will be happy
attached my code and my data.
thanks in advance

Respuesta aceptada

Shubham
Shubham el 5 de Nov. de 2024 a las 15:45
Hi Merlin,
It seems you are implementing a fuzzy-kNN algorithm in MATLAB for fault detection. Here are a few points to help improve your code structure and parameter handling:
  • Membership Matrix Initialization: Ensure the "M_y" matrix for the output membership is correctly initialized before the main computation loop to prevent unexpected behavior.
  • Distance Calculation and Weighing: When transforming distances, make sure the inverse power applied to "Dist" aligns with the fuzzy parameter "m". This step is crucial for determining the influence of nearby points:
Dist = Dist.^(-1/(m-1));
  • Cumulative Sum Calculations: Use "cumsum" instead of "cusum" for cumulative sum calculations:
CuSum_Dist = cumsum(Dist, 1);
CuSum_Mult = cumsum(TR_L .* repmat(Dist, [1, class_n]), 1);
  • Class Prediction: YEnsure your "predict_class" variable accurately holds the most likely class. The function for determining the maximum membership class, such as "likelihood2class", should correctly extract the highest membership value for each test sample.
  • Reading the Dataset: Use "readmatrix" or "readtable" to load your data from "Dataset.xlsx":
dataset = readmatrix('Dataset.xlsx');
These adjustments should help resolve the primary issues with fuzzy-kNN implementation.
For more information on "cumsum", refer to the following documentation link:
Hope this helps

Más respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by