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.
背景と目的
• システム同定方法
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
ルールベースを獲得する。• Architecture
An adaptive network
学習規則基本的な方法: 最急降下法 と 連鎖法則
ANFIS: Hybrid
学習規則Premise part Consequent part
ANFIS
Layer 3: Normalized firing strengths
Ratio: , 1 , 2 .
2 1
+ =
=
ii
i
w w
w w
Layer 4: node function
. 2 , 1 ),
4
= f = ( p x + q y + r i =
O
iw
i iw
i i i iLayer 5: Summation
å w f
vectors parameter
consequent as
r q p
i,
i,
i) (
Layer 2: Multiplication or T-norm operator Output of firing strengths :
. 2 , 1 ),
( )
( ´ =
=
Aix
Biy i
i
m m
w
. 2 , 1 ),
( )
(
, = x AND y i =
or w
im
Aim
BiLayer 1: node function Bell function
Gaussian function
i
i b
i A i
a c x x
] ) [(
1 ) 1 (
-
2+
= m
] ) (
exp[
)
(
2i A i
a c x x
i
- - m =
vectors parameter
premise as
c
b
a , , )
(
ANFIS
• Hybrid 学習規則
Reference
:NN BP Algorithm
ANFIS
• Example
2 5 . 1 1
5 .
0
)
1 ( ) , ,
( x y z = + x + y
-+ z
-f
Data pairs are obtained from
3 inputs, 2 MFs, 8 rules
Training data set size: 216
Checking data set size: 125
ANFIS
• Result
a. Step size from 0.01 to 0.09
b. Training error (solid line) and checking error(dashed line)
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
コマンドによる ANFIS
1. ANFIS とは
【名称】
•
適応ニューロファジィ推論システム• Adaptive Neuro-Fuzzy Inference System
【目的】
•
制御実測データからファジィモデルを同定する【方法】
•
与えられた入出力データから、二つの学習手法のうちどちらかを用いて メンバーシップの関数のパラメータ訓練を行う【学習手法】
•
バックプロパゲーション最急降下法のみ•
バックプロパゲーション最急降下法と最小二乗法を組み合わせたもの・・・ のどちらかを選択
知的制御システム研究室資料
(2008
川名)ANFIS の使用
【使用方法】
① ANFIS Editor GUI
②コマンドライン : anfis 関数
例題を用いて説明
例) 倒立振子制御の入出力データから 用いた(ファジィ)制御を同定する コマンドで関数を用いることにより 自由にプログラミング可能である。
応用の幅が広がる。
コマンドラインからの ANFIS 実行手順
Step1. データ収集ブロックの作成
Step2. 制御実行(制御の入出力データを保存)
Step3. 入出力データから訓練用データを設定
Step4. 初期FISモデルを設定
Step5. 学習方法を設定
Step6. 学習開始
Step7. 学習完了
Step1. データ収集ブロックの作成
• 制御の入出力データを保存するブロックを追 加
cart position
cart velocity cart position angle velocity
angle
fuz_CONToutput fuz_CONTinput Target Position -C-
(Mouse-Driven) Target Position
Sw itch
Mux Mux
Fuzzy Logic Controller 1
Constant
Cart & Pole Dynamics
kaw _animcp Animation
Step2. 制御実行(入出力データ収集)
x
n
制御を実行し、入出力データを保存
・サンプリングタイム
0.01s
・実行時間
20
秒・入出力データ
入力(
, , ,
)4
個 出力(-10~10V)1個各
2000
個x & q q &
x
Step3. 訓練用データの設定
• 保存した入出力データから訓練用データを設定する
• trnData = [ input1, input2, … , output]
• N+1の行列
1:N : 入力データ N+1 : 出力データ
入力データ 出力データ
2000個
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出力のメンバシップ関数
Step4. 初期 FIS モデルの設定
• fis = genfis1 ( trn Data, numMFs, inputMF);
– numMFs = 2
– inputMF = ‘gbellmf‘ を指定
• 初期 FIS モデル
>>plotmf(fis,‘input’,1); >>gensurf(fis);
Step5. 学習方法の設定
• 関数 anfis の引数によって
– 学習方法
– 訓練回数 ・・・等
様々な設定ができる
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
: ステップサイズStep6. 学習開始
• 関数 anfis を使用し、学習を行う
• [ fismat1] = anfis ( trnData, fismat );
• 入力
– trnData : 訓練データ
– fismat : 入力 FIS モデル
• 出力
– fismat1 : チューニングされた FIS モデル
Step7. 学習完了 (1)
n 学習・チューニング後のFISモデル
>>plotmf(fismat1,‘input’,1); >>gensurf(fismat1);
【ファジィルール】 【ファジィ面】
Step7. 学習完了 (2)
n
学習用データを提供した元制御器のFISモデル(参考用)
>>plotmf(fismat1,‘input’,1); >>gensurf(fismat1);
【ファジィルール】 【ファジィ面】
結果(1)
• 元の制御器と同定した制御器の動作比較
・・・実測時と同様の目標値 (-1.5 と 1.5) のとき
0 2 4 6 8 10 12 14 16 18 20
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Cart position [m]
Target position
Cart position (元の制御器) Cart position (同定後の制御器)
結果(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]
Cart position [m]
Target position
Cart position (元の制御器) Cart position (同定後の制御器)