Can someone explain this error?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
0 投票
Error using evalfismex Illegal parameters in fisTriangleMf() --> b > c
Error in evalfis (line 83) [output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints);
採用された回答
Walter Roberson
2018 年 2 月 16 日
This is quite similar to the recent https://www.mathworks.com/matlabcentral/answers/380732-error-with-evalfis-function#answer_303446
You have a triangle shaped FIS membership function, https://www.mathworks.com/help/fuzzy/trimf.html . Triangle membership functions are defined by three parameters:
- "a" -- the x location at which the function stops being 0 and starts to rise
- "b" -- the x location of the peak, where the membership reaches 1, and the point at which the function starts falling again
- "c" -- the x location where the membership function stops falling and becomes 0 for the rest of x
In order for this to work properly, the location where the membership function stops falling and becomes 0 again, "c", must be after the location where the membership function reaches its peak, "b".
But in your FIS, you have a "c" value (marking end of the non-zero range) being less than the "b" value (marking the peak.) That is not valid.
20 件のコメント
jasleen kaur
2018 年 2 月 17 日
I have checked trim parameters the values are as per the guidelines still getting the same error
Walter Roberson
2018 年 2 月 18 日
At the command line command
dbstop if error
and run your code. When it stops in evalfis, save input and fis and numofpoints into a .mat file and attach that .mat file here for us to examine.
jasleen kaur
2018 年 2 月 19 日
Sir please have a look.
Walter Roberson
2018 年 2 月 19 日
Look at
fis.input(1).mf(2)
ans =
struct with fields:
name: 'LOW'
type: 'trimf'
params: [456687.92806951 632359.24622541 146310.607499114]
Notice that 146310.607499114 is less than 632359.24622541 . That is an invalid triangular modular function.
Your fis has a total of 8 of these invalid triangular modular functions (out of 34 modular functions)
Whatever you are doing is creating invalid FIS.
Are you doing something similar to alex tzal, using PSO to try to create FIS parameters?
jasleen kaur
2018 年 2 月 20 日
Yes, I am using PSO to tune ANFIS. Sir, when i check my params before running the code they seem to be fine but after running I am getting this error. What to do?
Walter Roberson
2018 年 2 月 20 日
Put in a linear constraint that forces the parameters to be in order, like I told alex tzal in https://www.mathworks.com/matlabcentral/answers/380732-error-with-evalfis-function#answer_303446
jasleen kaur
2018 年 2 月 22 日
Sir, I am unable to get this. Can you elaborate a bit how to put constraints.
Walter Roberson
2018 年 2 月 22 日
What matters is that you need a linear constraint to prevent the third parameter from being less than the second parameter. In terms of A, b linear inequalities, that would look like
A = [1 -1 0 0;
0 1 -1 0;
0 0 1 -1]
b = [0; 0; 0]
The above permits the values to be exactly equal. Getting a strict inequality is tricky because of round-off error, but you could often approximate by setting b to -eps in each location instead of 0
To be any more specific then this, I would need to see your call to the PSO, and I would need to know which PSO you are using.
jasleen kaur
2018 年 2 月 25 日
編集済み: jasleen kaur
2018 年 2 月 25 日
Where do I put this constraint?? I am using PSO in my ANFIS as per:
Walter Roberson
2018 年 2 月 25 日
That code appears to not be designed for constraints.
The relevant section of code is TrainAnfisUsingPSO.m starting at line 129 "% Update Velocity".
If you look at the section from line 145 "% Apply Position Limits" then after the two lines that are there that use min() and max() you could try adding
particle(i).Position = sort(particle(i).Position);
jasleen kaur
2018 年 2 月 25 日
After adding this, error changed to:
Starting PSO ... Error using evalfismex Illegal parameters in fisTriangleMf() --> a > b
Error in evalfis (line 83) [output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints);
Error in TrainFISCost (line 40) y=evalfis(x,fis);
Error in TrainAnfisUsingPSO>@(x)TrainFISCost(x,fis,data) (line 7) Problem.CostFunction=@(x) TrainFISCost(x,fis,data);
Walter Roberson
2018 年 2 月 25 日
Could you remind me which MATLAB version you are using? When I test with the original code, everything works fine through training, but then there are some warning messages about the inputs being out of range for evaluating with the Input data after training. I am not seeing an error message with the original code in R2013a or R2017b.
jasleen kaur
2018 年 2 月 25 日
I am using R2017b. even I am able to run the original code without any error.
Walter Roberson
2018 年 2 月 25 日
I tracked down the reason for the warnings that I see in evaluation of the input data after the FIS is fully trained.
The training data ranges between 0.6 and 312.9 for the first column, and 612.1 and 1801.8 for the second column.
The test data ranges between 0.7 and 314 for the first column, and 576.2 to 1798.8 for the second column.
So the test data has a first column entry that is larger than trained for, and has a second column entry that is smaller than trained for, and has a second column entry that is larger than trained for. A total of 3 entries are affected by having this data that is outside the range trained for.
However, I do not see the evalfismex error that you reported originally. What did you need to do to trigger that original error, before you made the change to TrainAnfisUsingPSO.m that I had suggested in response to the problem?
jasleen kaur
2018 年 2 月 26 日
I just modified the code to incorporate my fuzzy model.
Walter Roberson
2018 年 2 月 26 日
I need the modified routines to investigate.
jasleen kaur
2018 年 2 月 26 日
my call is fis=TrainAnfisUsingPSO(fis,transposed)
fis here is the updated_fis
Walter Roberson
2018 年 2 月 26 日
I had to modify two files. One of them, SetFISParams, I had it sort the parameters it was setting for each individual fis transfer function. That was enough to get rid of the crashes due to invalid parameters. The much more extensive changes needed were to main, which was unable to do the plotting because your input data was stored in the form of structures containing tables whereas the code expected pure numeric arrays -- and also because you had no test data.
jasleen kaur
2018 年 2 月 27 日
編集済み: jasleen kaur
2018 年 2 月 27 日
thank you so much sir for all your help and guidance. I am really grateful to you.
AMLES MOUB
2019 年 1 月 10 日
Hello,
Please, I want to know how to optimize the ANFIS in real time which is involved in a simulink diagram..
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Fuzzy Inference System Tuning についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
