anfisttt.akiba.coocan.jp/.../intconthtms/text/sic09b_anfis.pdfanfis: adaptive-network-based fuzzy...
TRANSCRIPT
ANFIS:Adaptive-Network-Based Fuzzy Inference System
By Jyh-Shing Roger Jang
知的制御システム研究室資料
Jyh-Shing Roger Jang 、ANFIS: Adaptive Network Based Fuzzy Inference System、IEEE Trans. on Systems, Man and Cybernetics, vol. 23, no.3, pp.665-685, May 1993.
知的制御システム 講義資料
1993-2015 (c) [email protected] 1 / 24
背景と目的
• システム同定方法
1.伝統的な方法 例えば微分方程式
欠点:
ill-defined and uncertain systemsに対して同定は難しい
2.ファジィ同定 例えばTakagi-Sugeno方法欠点:
a. No standard method exist for transforming human knowledge into the rule base and database of a fuzzy inference system
b. No effective method for tuning the membership functions so as to minimize the output error measure or maximize performance index
ANFISを構築し、規定されてたデータ組に基づいて、パラメータを調整して、ファジィif-thenルールベースを獲得する。
知的制御システム 講義資料
1993-2015 (c) [email protected] 2 / 24
Adaptive Networks• Architecture
An adaptive network学習規則
基本的な方法: 最急降下法 と 連鎖法則
ANFIS: Hybrid学習規則
Premise part Consequent part
知的制御システム 講義資料
1993-2015 (c) [email protected] 3 / 24
ANFIS
Layer 3: Normalized firing strengths
Ratio: .2,1,21
=+
= iii ωω
ωω
Layer 4: node function
.2,1),(4 =++== iryqxpfO iiiiiii ωω
Layer 5: Summation
.2,1,51 ==== ∑ ∑
∑ if
foutputoverallOi i i
i iiii ω
ωω
vectorsparameterconsequentasrqp iii ),,(
Layer 2: Multiplication or T-norm operator
Output of firing strengths :.2,1),()( =×= iyx
ii BAi µµω.2,1),()(, == iyANDxor
ii BAi µµω
Layer 1: node function
Bell function
Gaussian function
ii
b
i
iA
acxx
])[(1
1)(2−
+=µ
])(exp[)( 2
i
iA a
cxxi
−−=µ
vectorsparameterpremiseascba iii ),,(
知的制御システム 講義資料
1993-2015 (c) [email protected] 4 / 24
ANFIS• Example
25.115.0 )1(),,( −− +++= zyxzyxfData pairs are obtained from
3 inputs, 2 MFs, 8 rules
Training data set size: 216
Checking data set size: 125
知的制御システム 講義資料
1993-2015 (c) [email protected] 6 / 24
ANFIS• Result
a. Step size from 0.01 to 0.09b. Training error (solid line) and checking error(dashed line)
知的制御システム 講義資料
1993-2015 (c) [email protected] 7 / 24
Ill-defined problem
1.問題に関する決定的な(definitive)定式化はないThere is no definitive formulation of the problem
2.問題に関するどんな定式化も非一貫性を含みうるAny problem formulation may embody inconsistencies
3.問題の定式化は、解決策依存Formulations of the problem are solution-dependent
4.解決策の提案は、問題理解の手段の一つであるProposing solutions is a means of understanding the problem
5.問題に対する決定的な解決策はないThere is no definitive solution to the problem
By Nigel Cross, Engineering Design Methods
知的制御システム 講義資料
1993-2015 (c) [email protected] 8 / 24
コマンドによるANFIS
1.ANFISとは
【名称】
• 適応ニューロファジィ推論システム
• Adaptive Neuro-Fuzzy Inference System【目的】
• 制御実測データからファジィモデルを同定する
【方法】
• 与えられた入出力データから、二つの学習手法のうちどちらかを用いてメンバーシップの関数のパラメータ訓練を行う
【学習手法】
• バックプロパゲーション最急降下法のみ
• バックプロパゲーション最急降下法と最小二乗法を組み合わせたもの
・・・ のどちらかを選択
知的制御システム研究室資料(2008川名)
知的制御システム 講義資料
1993-2015 (c) [email protected] 9 / 24
ANFISの使用
【使用方法】
①ANFIS Editor GUI②コマンドライン : anfis関数
例題を用いて説明
例) 倒立振子制御の入出力データから用いた(ファジィ)制御を同定する
コマンドで関数を用いることにより自由にプログラミング可能である。
応用の幅が広がる。
知的制御システム 講義資料
1993-2015 (c) [email protected] 10 / 24
コマンドラインからのANFIS実行手順
Step1. データ収集ブロックの作成
Step2. 制御実行(制御の入出力データを保存)
Step3. 入出力データから訓練用データを設定
Step4. 初期FISモデルを設定
Step5. 学習方法を設定
Step6. 学習開始
Step7. 学習完了
知的制御システム 講義資料
1993-2015 (c) [email protected] 11 / 24
Step1. データ収集ブロックの作成
• 制御の入出力データを保存するブロックを追加
cart position
cart velocitycart position
angle velocityangle
fuz_CONToutput
To Workspace1
fuz_CONTinput
To Workspace
-C-Target Position(Mouse-Driven)
Target PositionSw itch
Mux
Mux
Fuzzy LogicController
1Constant
Cart & PoleDynamics
kaw _animcp
Animation
追加
知的制御システム 講義資料
1993-2015 (c) [email protected] 12 / 24
Step2. 制御実行(入出力データ収集)
x
n 制御を実行し、入出力データを保存
・サンプリングタイム 0.01s・実行時間 20秒・入出力データ入力( , , , ) 4個出力(-10~10V)1個各 2000個
x& θ θ&x
知的制御システム 講義資料
1993-2015 (c) [email protected] 13 / 24
Step3. 訓練用データの設定• 保存した入出力データから訓練用データを設定する
• trnData = [ input1, input2, … , output]
• N+1の行列
1:N : 入力データ
N+1 : 出力データ
入力データ 出力データ
2000個
知的制御システム 講義資料
1993-2015 (c) [email protected] 14 / 24
Step4. 初期FISモデルの設定
• 関数genfis1を使用し、ANFISのための初期菅野タイプのファジィ推論システム(FIS)を作成する
gaussmf gaussmf2 gbellmf sigmf dsigmf psigmf zmf pimf smf
n fis = genfis1 ( trnData, numMFs, inputMF);
n 入力– trnData : N+1(N:入力データ、1:出力データ)の行列
– numMFs : 各入力に関するメンバシップ関数の数を指定
– inputMF : 各入力に関するメンバシップ関数のタイプを指定
n 出力– fis : 生成される各ルールは1出力のメンバシップ関数
知的制御システム 講義資料
1993-2015 (c) [email protected] 15 / 24
Step4. 初期FISモデルの設定• fis = genfis1 ( trnData, numMFs, inputMF);
– numMFs = 2– inputMF = ‘gbellmf‘ を指定
• 初期FISモデル>>plotmf(fis,‘input’,1); >>gensurf(fis);
【ファジィルール】 【ファジィ面】
知的制御システム 講義資料
1993-2015 (c) [email protected] 16 / 24
Step5. 学習方法の設定
• 関数 anfis の引数によって– 学習方法
– 訓練回数 ・・・等
様々な設定ができる
知的制御システム 講義資料
1993-2015 (c) [email protected] 17 / 24
Step5. 学習方法の設定
• [fismat1, trnError, ss, fismat2, chkError] = ... anfis (trnData, fismat, trnOpt, dispOpt,
chkData, method);• 入力
– trnData :訓練データ– fismat :入力FISモデル– trnOpt :訓練オプション指定のためのベクトル(訓練回数; 訓練誤差の目標; 初期ステップサイズ; ステップサイズの減少率; ステップサイズの増加率;)
– dispOpt :表示オプション指定のためのベクトル(一般的なANFIS情報; エラー; 各パラメータ更新時のステップサイズ; 最終結果;)
– chkData : 各訓練での機能チェック用データ– method : 学習方法の選択(デフォルト1は最小二乗推定とバックプロパゲーションの結合したハイブリッド法、 0はバックプロパゲーション法)
• 出力– fismat1 : チューニングされたFISモデル– trnError : 各訓練における訓練誤差(FIS出力と訓練データの出力との差)の平均二乗根の配列
– Ss : ステップサイズ– fismat2 : 最小チェック誤差を持つFISモデル– chkError : チェック誤差(チェックデータ出力値と同じデータの入力値に対応するANFISの出力の差 )
知的制御システム 講義資料
1993-2015 (c) [email protected] 18 / 24
Step6. 学習開始
• 関数anfisを使用し、学習を行う
• [ fismat1] = anfis ( trnData, fismat ); • 入力
– trnData :訓練データ
– fismat :入力FISモデル
• 出力– fismat1 : チューニングされたFISモデル
知的制御システム 講義資料
1993-2015 (c) [email protected] 19 / 24
Step7. 学習完了(1)n 学習・チューニング後のFISモデル
>>plotmf(fismat1,‘input’,1); >>gensurf(fismat1);
【ファジィルール】 【ファジィ面】
知的制御システム 講義資料
1993-2015 (c) [email protected] 20 / 24
Step7. 学習完了(2)n 学習用データを提供した元制御器のFISモデル(参考用)
>>plotmf(fismat1,‘input’,1); >>gensurf(fismat1);
【ファジィルール】 【ファジィ面】
知的制御システム 講義資料
1993-2015 (c) [email protected] 21 / 24
結果(1)• 元の制御器と同定した制御器の動作比較
・・・実測時と同様の目標値(-1.5と1.5)のとき
ANFISで同定した制御器は、元の制御器と同様、倒立維持に成功挙動は全く同じ
0 2 4 6 8 10 12 14 16 18 20-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Time [sec]
Car
t po
sitio
n [
m]
Target position
Cart position (元の制御器)Cart position (同定後の制御器)
知的制御システム 講義資料
1993-2015 (c) [email protected] 22 / 24
結果(2)
• 元の制御器と同定した制御器の動作比較
・・・実測時と異なる目標値(-1.0と1.0)のとき
0 2 4 6 8 10 12 14 16 18 20-1.5
-1
-0.5
0
0.5
1
1.5
Time [sec]
Car
t pos
itio
n [m
]
Target positionCart position (元の制御器)Cart position (同定後の制御器)
ANFISで同定した制御器は、元の制御器と同様、倒立維持に成功-1と1付近のデータが少ないために、挙動は異なる。
知的制御システム 講義資料
1993-2015 (c) [email protected] 23 / 24
まとめ• コマンドラインにて関数を用いて、ANFIS(適応ニューロファ
ジィ推論システム)を実行した。
• 関数を用いることによりs-functionにて使用ができ、自由にプログラミングが可能であり、様々な応用ができる。
% a1go.m: mdl を実行し、結果をWorkfile へ格納する。ANFISkaw_slcp
% a2go.m: fuz_trnData = [fuz_CONTinput(1:2001,1) fuz_CONTinput(1:2001,2) fuz_CONTinput(1:2001,3) fuz_CONTinput(1:2001,4) fuz_CONToutput(1:2001)]; %訓練データ(最後の行は出力、それ以外の行は入力)
numMFs = 2; %メンバシップ関数の数mfType = 'gbellmf'; %'trimf'; %メンバシップ関数の形fuz_in_fismat = genfis1(fuz_trnData,numMFs,mfType); %データからFIS構造体(numMFsとmfType)を作成figure;subplot(4,1,1), plotmf(fuz_in_fismat,'input',1); %入力1のルールをプロットsubplot(4,1,2), plotmf(fuz_in_fismat,'input',2); %入力2のルールをプロットsubplot(4,1,3), plotmf(fuz_in_fismat,'input',3); %入力3のルールをプロットsubplot(4,1,4), plotmf(fuz_in_fismat,'input',4); %入力4のルールをプロットepoch_n=5; %訓練回数[fuz_out_fismat,out_error] = anfis(fuz_trnData,fuz_in_fismat); figure; gensurf(fuz_out_fismat);
知的制御システム 講義資料
1993-2015 (c) [email protected] 24 / 24