how to implement fuzzy-KNN code to fault detection

16 ビュー (過去 30 日間)
merlin toche
merlin toche 2023 年 2 月 15 日
回答済み: Shubham 2024 年 11 月 5 日 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

採用された回答

Shubham
Shubham 2024 年 11 月 5 日 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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by