SlideShare a Scribd company logo
1 of 66
ルールエンジンの心臓部
RETEアルゴリズムを使いこなせ!
レッドハット株式会社
Chief Technologist
梅野 昌彦
Red Hat Forum Tokyo 2018
AP09
ルールエンジンとは…
Copyright © 2018 Red Hat K.K. All Rights Reserved.2
いろいろな種類のデータの関連性から、新しいアクションを起こす変換器
例えば…
通信手段
いちご味を多く買っている人へ
よく閲覧している時間に
好みの通信手段で広告を打つ購買履歴
12:13
閲覧履歴
本日の内容
Copyright © 2018 Red Hat K.K. All Rights Reserved.3
RETE
アルゴリズム
基本的な
動作
機械学習
への応用
RETE アルゴリズム
Copyright © 2018 Red Hat K.K. All Rights Reserved.4
プロダクションシステムを実現するために考えられた、
効率的なパターンマッチングアルゴリズム
プロダクションシステム:自動計画・エキスパートシステム・行動選択
知識データ 行動
ルールエンジンの歴史
Copyright © 2018 Red Hat K.K. All Rights Reserved.5
Mycin
Dendral
1972
エキスパートシステムからスタート
Prolog
RETE
1974
OPS5
CLIPS
Jess
DroolsSoar
ILOG
Rules
1984
1983
1995
2001
1987
JBoss Enterprise
BRMS 5
2009
現在
1996
Red Hat
JBoss
BRMS 6
RETE
誕生
ルールエンジンの構造
Copyright © 2018 Red Hat K.K. All Rights Reserved.6
ワーキングメモリー プロダクションメモリー
アジェンダ
データ (Fact) が入るところ
データとルールがマッチングした実行候補 (Activation) が入るところ
知識 (Rule) が入るところ
基本的な動作
RETEアルゴリズムの
トラックと運転手のマッチング
Copyright © 2017 Red Hat K.K. All Rights Reserved.8
ルール
• 壊れたトラックと修理部品がある場合、修理する。
• 乗れるトラックと運転手がいる場合、乗車する。
ルールエンジンを使用することで、どのような処理の流れになるか?
All pictures drawn by Nagisa.
Step 1/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.9
ワーキングメモリー プロダクションメモリー
アジェンダ
条件
アクション
条件
アクション
Step 2/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.10
ワーキングメモリー
条件
アクション
条件
アクション
プロダクションメモリー
アジェンダ 条件
アクション
Step 3/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.11
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 4/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.12
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 5/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.13
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 6/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.14
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 7/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.15
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 8/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.16
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 9/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.17
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 10/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.18
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 11/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.19
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
Step 12/12
Copyright © 2017 Red Hat K.K. All Rights Reserved.20
ワーキングメモリー
アジェンダ
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
条件
アクション
プロダクションメモリー
データモデル (Fact)
Copyright © 2012 Red Hat, Inc.
public class Truck {
private String Color;
private String Parts;
private String Driver;
}
public class Parts {
private String Parts;
}
public class Driver {
private String Name;
}
21
データモデルを考えます。
トラックの属性値として何がある
か等を考慮して、クラスとメン
バーを作成していきます。
ルール
Copyright © 2012 Red Hat, Inc.
rule "Repear"
salience 100
when
p : Parts ()
t : Truck (parts == p.parts )
then
t.setParts ("Complete");
retract (p);
update (t);
end
rule "Matching"
salience 10
when
t : Truck (parts == "Complete", driver == "")
d : Driver (n : name )
then
t.setDriver (n);
retract (d);
update (t);
end
22
Update (x);
Fact xに変更があったことをルールエンジン
に通知する。ルールエンジンは新しくなった
Fact でルールを再評価し、マッチすればア
ジェンダにActivationを作る。
Retract (x);
ワーキングメモリーからFact x を消去する。
消去されたことによりアジェンダから
Activationを消去する。
Audit ルールの動作が確認できます
FactがUpdateされることで
ルールとマッチングされ、
Activationが作成
FactがInsertされることで
ルールとマッチングされ、
Activationが作成
Factがremoveされることで
ルールとのマッチングが
無くなりActivationがCancel
Copyright © 2012 Red Hat, Inc.23
RETEアルゴリズムの特性
Copyright © 2018 Red Hat K.K. All Rights Reserved.24
• オブジェクト(Factとルール、FactとFactとルール等)
の関係性より、アクションを起こすエンジン
• Factが更新され、ルールエンジンに通知すると、再評価
が行われ、その時にマッチしたオブジェクトとルールの
組み合わせで逐次実行される
• 組合せ爆発に弱い
• 無限ループは検知できない
– ルールの実行回数で判断し中止することが可能
PHREAK
Copyright © 2018 Red Hat K.K. All Rights Reserved.25
• (Marc) Proctor’s Hybrid Reasoning Engine for Advanced
Knowledge
– RETEOO(RETE Object Oriented)を改良したもの
• 遅延評価
– 一気に評価をするのではなく、Agendaでの組合せ爆発を
防ぐ(条件が多段の場合)
• 高速化
– 評価部分のマルチスレッド化
– 実行部分のマルチスレッド化
RETE アルゴリズムを有効に活用できる業務
Copyright © 2018 Red Hat K.K. All Rights Reserved.26
機能 内容
相関チェック 業務観点 申込審査・査定・対象の導出・DBのデータ品質のチェック等
システム
観点
階層化・分散されたデータの相関チェック
集計処理 業務観点 代理店インセンティブ計算・費目ごとの集計やシミュレー
ション
システム
観点
階層化・分散されたデータの計算・集計
推論 業務観点 生産管理・工程計画・ルーティング
システム
観点
前向き推論・後ろ向き推論・Truth Maintenance System
Red Hat Decision Managerのルールエンジン
Copyright © 2018 Red Hat K.K. All Rights Reserved.27
• データに基づきルールが評価される
• 推論機構にて連続発火し、再評価を行うことで、複雑な
ロジックでもシンプルに作ることができる
• 実行結果のトレースがとれるので、ブラックボックス化
しない
• RETEアルゴリズムの進化版の PHREAKを搭載
• 単なるif-thenのエンジンではない!
機械学習への適用
人工知能における学習の種類
Copyright © 2018 Red Hat K.K. All Rights Reserved.29
教師あり
機械学習
教師なし
機械学習
人間の手打ち
による学習
ビジネスルール
教師あり学習
• ニューラルネットワーク
• 回帰
• Tree
• 単純ベイズ
• クラスタリング k近傍法
教師なし学習
• 主成分分析
• クラスタリング k平均法
• ベクトル量子化
• 自己組織化マップ
クラスタリング
Copyright © 2018 Red Hat K.K. All Rights Reserved.30
• 機械学習の一つ
• 原始的だが重要な手法
• データマイニングなどでよく使われている
• 答えは「場合分け」
• 答えを「教師あり学習」「ルール」として使う
• 非階層的手法:k平均法
• 階層化手法:最短距離法・最長距離法・群平均法…
最短距離法の手順
Copyright © 2018 Red Hat K.K. All Rights Reserved.31
1. 任意の2つのオブジェクトの距離を計算
2. 任意の2つのオブジェクトのうち、一番小さな距離間
のオブジェクトを抽出し、その重心を新たにオブジェ
クトとして作成する。新しいオブジェクトと、2つの
オブジェクトの関係性を記録する。
3. オブジェクトは複数のグループに所属出来ないので、
異なるグループに所属している場合はどちらかのグ
ループに属することを諦める
4. オブジェクトの総数が希望するクラスタ数よりも多い
場合、1-4を繰り返す。
簡単に、1次元の場合
最短距離法でルールエンジンを使ってクラスタリング
データ
Copyright © 2018 Red Hat K.K. All Rights Reserved.33
7 8 18 27 37.5 62 72 73 89 96
• 0〜100の数値
• 点の数は10個(重複もありうる)
• ランダムにプロット
3つに分類する
最終目標
Copyright © 2018 Red Hat K.K. All Rights Reserved.34
7.5
92.526.25 67.25
15
37.5
22.5
62
72.5
18 27 89 967 8 72 73
データモデル (Fact)
Copyright © 2018 Red Hat K.K. All Rights Reserved.35
public class Distance {
private double distance;
private AnalysisData a1;
private AnalysisData a2; }
2点間のオブジェクトとその距離
public class AnalysisData {
private double x;
private double y;
private String Tag="";
private int Color=0;
private int level=0;
private ArrayList<AnalysisData> subsidiary;}
クラスタリングするデータ
座標と幾つかの識別フラグ、
自分がどのデータに含まれるかのリスト
作成したルール
Copyright © 2018 Red Hat K.K. All Rights Reserved.36
rule “2点間の距離を計算”
rule “最小の距離を抽出し、新しい重心を作成”
rule “子が重複したクラスタを取り除き、子にならないものを子から外す”
rule “クラスタ数をチェックし、距離情報を削除”
rule “最上階層の色付け”
rule “その他の階層は最上階層の色とする"
クラスタリング
色付け
Copyright © 2018 Red Hat K.K. All Rights Reserved.37
rule "2点間の距離を計算"
salience 100
when
ad1: AnalysisData(x1:x , y1:y, tag =="")
ad2: AnalysisData(x2:x >=x1 , y2:y, tag =="", this != ad1)
not Distance(a1==ad1, a2==ad2)
not Distance(a1==ad2, a2==ad1)
then
Distance d = new Distance();
d.setDistance(Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2)));
d.setA1(ad1);
d.setA2(ad2);
insert (d);
end
tag:自分が子となった場合にChildとする
距離の計算はユークリッド距離を使用
Copyright © 2018 Red Hat K.K. All Rights Reserved.38
rule “最小の距離を抽出し、新しい重心を作成"
salience 100
when
d1 : Distance( minDist:distance )
not Distance( distance < minDist)
A1 : AnalysisData( tag =="") from d1.getA1
A2 : AnalysisData( tag =="") from d1.getA2
NumberOfCluster( number > CulsterNumber )
then
AnalysisData ad = new AnalysisData();
ad.setX((d1.getA1().getX()+d1.getA2().getX())/2);
ad.setY((d1.getA1().getY()+d1.getA2().getY())/2);
ad.setTag("");
ad.setLevel(1);
ad.addSubsidiary(d1.getA1());
ad.addSubsidiary(d1.getA2());
insert(ad);
A1.setTag(“Child”); update(A1);
A2.setTag(“Child”); update(A2);
retract(d1);
end
tag:自分が子となった場合にChildとする
自分の距離より小さいものがない
= 自分自身は最小
Level:階層化されたフラグ
(初期値は0)
新しい重心を作成
(元データと同じデータ型)
新しい重心ができたことをルールエンジンに通知
Copyright © 2018 Red Hat K.K. All Rights Reserved.39
rule "子が重複したクラスタを取り除き、子にならないものを子から外す"
salience 200
when
ad1: AnalysisData( )
ad2: AnalysisData( tag =="", subsidiary contains ad1)
ad3: AnalysisData( this != ad2, subsidiary contains ad1)
ad4: AnalysisData( this != ad1 ) from ad3.getSubsidiary()
ad5: AnalysisData( this != ad1, this != ad4) from ad2.getSubsidiary()
then
ad4.setTag("");
retract (ad3);
update(ad4);
end
Copyright © 2018 Red Hat K.K. All Rights Reserved.40
rule “クラスタ数をチェックし、距離情報を消し、再評価のきっかけを作る"
salience -100
when
total: Number(intValue >= CulsterNumber.intValue())
from accumulate (AD: AnalysisData( tag != "Child"), count(AD))
noc: NumberOfCluster()
d: Distance()
then
noc.setNumber(total.intValue());
update (noc);
retract (d);
end
Tagが Childでないものが、クラスタのParentノード
分割したい数
C
CC C
Step 1
Copyright © 2018 Red Hat K.K. All Rights Reserved.41
7 8 18 27 37.5 62 72 73 89 96
Step 1
Copyright © 2018 Red Hat K.K. All Rights Reserved.42
7 8 18 27 37.5 62 72 73 89 96
1 10 9 11 24 10 1 16 7
7.5 72.518 27 37.5 62 89 96
分類数:8
Step 2
Copyright © 2018 Red Hat K.K. All Rights Reserved.43
18 27 37.5 62 89 967.5 72.5
11.5 24 10.5 16.5 79 11
92.518 27 37.5 62 72.57.5
分類数:7
Step 3
Copyright © 2018 Red Hat K.K. All Rights Reserved.44
18 27 37.5 627.5 72.5 92.5
11.5 24 10.59 11 20
37.5 62 72.57.5 92.522.5
分類数:6
Step 4
Copyright © 2018 Red Hat K.K. All Rights Reserved.45
37.5 627.5 72.5 92.5
15 24 10.515 20
22.5
37.57.5 92.522.5 67.25
分類数:5
Step5
Copyright © 2018 Red Hat K.K. All Rights Reserved.46
37.57.5 92.5
15
15 29.7515 25.25
22.5
30
67.25
92.567.25
分類数:4
Copyright © 2018 Red Hat K.K. All Rights Reserved.47
rule "子が重複したクラスタを取り除き、子にならないものを子から外す"
salience 200
when
ad1: AnalysisData( )
ad2: AnalysisData( tag =="", subsidiary contains ad1)
ad3: AnalysisData( this != ad2, subsidiary contains ad1)
ad4: AnalysisData( this != ad1 ) from ad3.getSubsidiary()
ad5: AnalysisData( this != ad1, this != ad4) from ad2.getSubsidiary ()
then
ad4.setTag("");
retract (ad3);
update(ad4);
end
37.57.5
15 15
15
22.5
30
ad4
ad2
ad1
ad3
ad5
Copyright © 2018 Red Hat K.K. All Rights Reserved.48
rule "子が重複したクラスタを取り除き、子にならないものを子から外す"
salience 200
when
ad1: AnalysisData( )
ad2: AnalysisData(this != ad1)
ad3: AnalysisData(this != ad1, this != ad2)
ad4: AnalysisData(tag =="", subsidiary contains ad1, subsidiary contains ad2)
ad5: AnalysisData(tag =="", this != ad4, subsidiary contains ad2, subsidiary contains ad3)
then
ad3.setTag("");
update(ad3);
retract (ad5);
end
37.57.5
15 15
15
22.5
30
ad3
ad4
ad2
ad5
ad1
Bad!
500C3 = 2,070万
Step5
Copyright © 2018 Red Hat K.K. All Rights Reserved.49
37.57.5 92.5
15 29.7515 25.25
22.5 67.25
92.567.2515 30
分類数:4
307.5 22.5
Step6
Copyright © 2018 Red Hat K.K. All Rights Reserved.50
92.5
26.25
22.5 29.75 25.25
67.25
92.567.25
分類数:3
15 37.5
Step7 階層化表示
Copyright © 2018 Red Hat K.K. All Rights Reserved.51
7.5
92.526.25 67.25
15
37.5
22.5
62
72.5
18 27 89 967 8 72 73
Step7 階層化表示
Copyright © 2018 Red Hat K.K. All Rights Reserved.52
7.5
92.526.25 67.25
15
37.5
22.5
62
72.5
18 27 89 967 8 72 73
K-平均法の手順
Copyright © 2018 Red Hat K.K. All Rights Reserved.53
1. データに分類したいラベルを付ける。(Randomに)
2. それぞれのラベルの重心を求める。
3. データとラベルの距離を計算し、一番近いラベルをつ
け直す。
4. 重心の位置が動かなくなるまで2-3を繰り返す。
K-平均法
Copyright © 2018 Red Hat K.K. All Rights Reserved.54
7 8 18 27 37.5 62 72 73 89 96
50.5
39.5 56.3
7 8 18 27 37.5 62 72 73 89 96
19.5 50.5 78.4
7 8 18 27 37.5 62 72 73 89 96
15.0 49.75 82.5
7 8 18 27 37.5 62 72 73 89 96
Copyright © 2018 Red Hat K.K. All Rights Reserved.55
7 8 18 27 37.5 62 72 73 89 96
k-平均法による結果
7 8 18 27 37.5 62 72 73 89 96
最短距離法による結果
どちらの方式がより人間の感覚に近い?
2次元の場合は?
オリジナル
Copyright © 2018 Red Hat K.K. All Rights Reserved.57
• X値 y値ともに、0〜10,000の数値
• 点の数は500個(重複もありうる)
• ランダムにプロット
3クラスタ
Copyright © 2018 Red Hat K.K. All Rights Reserved.58
5クラスタ
Copyright © 2018 Red Hat K.K. All Rights Reserved.59
10クラスタ
Copyright © 2018 Red Hat K.K. All Rights Reserved.60
15クラスタ
Copyright © 2018 Red Hat K.K. All Rights Reserved.61
まとめ
ルールエンジンの心臓部
RETEアルゴリズムを使いこなせ!
まとめ
Copyright © 2018 Red Hat K.K. All Rights Reserved.63
• ルールエンジンは単なるIf-Thenのエンジンではない!
• RETEアルゴリズムは、繰り返し処理や複雑な動きを再
評価・実行することで、ルールを簡単に書ける仕組みで
ある
• ルールはオブジェクトの組み合わせを常に意識して書く
• 機械学習にも使える!
Decision Manager 関連セッション
Copyright © 2018 Red Hat K.K. All Rights Reserved.64
Copyright © 2018 Red Hat K.K. All Rights Reserved.65
17:35 アイデアソン表彰式
https://jp-redhat.com/forum-ideathon/
ありがとうございました
plus.google.com/+RedHat
linkedin.com/company/red-hat
youtube.com/user/RedHatVideos
facebook.com/redhatinc
twitter.com/RedHatNews
梅野 昌彦: mumeno@redhat.com

More Related Content

What's hot

Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)NTT DATA OSS Professional Services
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Etsuji Nakai
 
実装して理解するLINE LoginとOpenID Connect入門
実装して理解するLINE LoginとOpenID Connect入門実装して理解するLINE LoginとOpenID Connect入門
実装して理解するLINE LoginとOpenID Connect入門Naohiro Fujie
 
イミュータブルデータモデルの極意
イミュータブルデータモデルの極意イミュータブルデータモデルの極意
イミュータブルデータモデルの極意Yoshitaka Kawashima
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Akihiro Suda
 
イミュータブルデータモデル(世代編)
イミュータブルデータモデル(世代編)イミュータブルデータモデル(世代編)
イミュータブルデータモデル(世代編)Yoshitaka Kawashima
 
ドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみようドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみよう増田 亨
 
分散システムについて語らせてくれ
分散システムについて語らせてくれ分散システムについて語らせてくれ
分散システムについて語らせてくれKumazaki Hiroki
 
Cognitive Complexity でコードの複雑さを定量的に計測しよう
Cognitive Complexity でコードの複雑さを定量的に計測しようCognitive Complexity でコードの複雑さを定量的に計測しよう
Cognitive Complexity でコードの複雑さを定量的に計測しようShuto Suzuki
 
なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)
なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)
なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)Mikiya Okuno
 
DXとかDevOpsとかのなんかいい感じのやつ 富士通TechLive
DXとかDevOpsとかのなんかいい感じのやつ 富士通TechLiveDXとかDevOpsとかのなんかいい感じのやつ 富士通TechLive
DXとかDevOpsとかのなんかいい感じのやつ 富士通TechLiveTokoroten Nakayama
 
コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!オラクルエンジニア通信
 
BuildKitの概要と最近の機能
BuildKitの概要と最近の機能BuildKitの概要と最近の機能
BuildKitの概要と最近の機能Kohei Tokunaga
 
AWSではじめるMLOps
AWSではじめるMLOpsAWSではじめるMLOps
AWSではじめるMLOpsMariOhbuchi
 
Hyper-V ネットワークの基本
Hyper-V ネットワークの基本Hyper-V ネットワークの基本
Hyper-V ネットワークの基本Syuichi Murashima
 
新入社員のための大規模ゲーム開発入門 サーバサイド編
新入社員のための大規模ゲーム開発入門 サーバサイド編新入社員のための大規模ゲーム開発入門 サーバサイド編
新入社員のための大規模ゲーム開発入門 サーバサイド編infinite_loop
 
ドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解するドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解する増田 亨
 
BuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドBuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドAkihiro Suda
 
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)NTT DATA Technology & Innovation
 
こわくない Git
こわくない Gitこわくない Git
こわくない GitKota Saito
 

What's hot (20)

Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門
 
実装して理解するLINE LoginとOpenID Connect入門
実装して理解するLINE LoginとOpenID Connect入門実装して理解するLINE LoginとOpenID Connect入門
実装して理解するLINE LoginとOpenID Connect入門
 
イミュータブルデータモデルの極意
イミュータブルデータモデルの極意イミュータブルデータモデルの極意
イミュータブルデータモデルの極意
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行
 
イミュータブルデータモデル(世代編)
イミュータブルデータモデル(世代編)イミュータブルデータモデル(世代編)
イミュータブルデータモデル(世代編)
 
ドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみようドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみよう
 
分散システムについて語らせてくれ
分散システムについて語らせてくれ分散システムについて語らせてくれ
分散システムについて語らせてくれ
 
Cognitive Complexity でコードの複雑さを定量的に計測しよう
Cognitive Complexity でコードの複雑さを定量的に計測しようCognitive Complexity でコードの複雑さを定量的に計測しよう
Cognitive Complexity でコードの複雑さを定量的に計測しよう
 
なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)
なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)
なぜ、いま リレーショナルモデルなのか(理論から学ぶデータベース実践入門読書会スペシャル)
 
DXとかDevOpsとかのなんかいい感じのやつ 富士通TechLive
DXとかDevOpsとかのなんかいい感じのやつ 富士通TechLiveDXとかDevOpsとかのなんかいい感じのやつ 富士通TechLive
DXとかDevOpsとかのなんかいい感じのやつ 富士通TechLive
 
コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!
 
BuildKitの概要と最近の機能
BuildKitの概要と最近の機能BuildKitの概要と最近の機能
BuildKitの概要と最近の機能
 
AWSではじめるMLOps
AWSではじめるMLOpsAWSではじめるMLOps
AWSではじめるMLOps
 
Hyper-V ネットワークの基本
Hyper-V ネットワークの基本Hyper-V ネットワークの基本
Hyper-V ネットワークの基本
 
新入社員のための大規模ゲーム開発入門 サーバサイド編
新入社員のための大規模ゲーム開発入門 サーバサイド編新入社員のための大規模ゲーム開発入門 サーバサイド編
新入社員のための大規模ゲーム開発入門 サーバサイド編
 
ドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解するドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解する
 
BuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドBuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルド
 
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
 
こわくない Git
こわくない Gitこわくない Git
こわくない Git
 

Similar to RETEアルゴリズムを使いこなせ

Halide による画像処理プログラミング入門
Halide による画像処理プログラミング入門Halide による画像処理プログラミング入門
Halide による画像処理プログラミング入門Fixstars Corporation
 
タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-
タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-
タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-Takakiyo Tanaka
 
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送Google Cloud Platform - Japan
 
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送Google Cloud Platform - Japan
 
ネットワーク自動化の課題 - グラフデータベースによる解決
ネットワーク自動化の課題 - グラフデータベースによる解決ネットワーク自動化の課題 - グラフデータベースによる解決
ネットワーク自動化の課題 - グラフデータベースによる解決ApstraJapan
 
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsPL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsKohei KaiGai
 
[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築
[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築
[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築Naoki (Neo) SATO
 
Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18Masatomo Ito
 
アプリを成長させるためのログ取りとログ解析に必要なこと
アプリを成長させるためのログ取りとログ解析に必要なことアプリを成長させるためのログ取りとログ解析に必要なこと
アプリを成長させるためのログ取りとログ解析に必要なことTakao Sumitomo
 
Redshift Spectrumを使ってみた話
Redshift Spectrumを使ってみた話Redshift Spectrumを使ってみた話
Redshift Spectrumを使ってみた話Yoshiki Kouno
 
Tech Dojo 02/09 IBM Japan CSM
Tech Dojo 02/09 IBM Japan CSMTech Dojo 02/09 IBM Japan CSM
Tech Dojo 02/09 IBM Japan CSM勇 黒沢
 
Airflowを広告データのワークフローエンジンとして運用してみた話
Airflowを広告データのワークフローエンジンとして運用してみた話Airflowを広告データのワークフローエンジンとして運用してみた話
Airflowを広告データのワークフローエンジンとして運用してみた話Katsunori Kanda
 
第3回 配信講義 計算科学技術特論B(2022)
第3回 配信講義 計算科学技術特論B(2022)第3回 配信講義 計算科学技術特論B(2022)
第3回 配信講義 計算科学技術特論B(2022)RCCSRENKEI
 
C base design methodology with s dx and xilinx ml
C base design methodology with s dx and xilinx ml C base design methodology with s dx and xilinx ml
C base design methodology with s dx and xilinx ml ssuser3a4b8c
 
LoRaWANとAzure IoT Hub接続ハンズオン
LoRaWANとAzure IoT Hub接続ハンズオンLoRaWANとAzure IoT Hub接続ハンズオン
LoRaWANとAzure IoT Hub接続ハンズオンTomokazu Kizawa
 
トレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するトレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するTakahiro Inoue
 
Lambda in template_final
Lambda in template_finalLambda in template_final
Lambda in template_finalCryolite
 
20181212 - PGconf.ASIA - LT
20181212 - PGconf.ASIA - LT20181212 - PGconf.ASIA - LT
20181212 - PGconf.ASIA - LTKohei KaiGai
 

Similar to RETEアルゴリズムを使いこなせ (20)

Halide による画像処理プログラミング入門
Halide による画像処理プログラミング入門Halide による画像処理プログラミング入門
Halide による画像処理プログラミング入門
 
タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-
タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-
タイムマシン採用:明日のエンタープライズJavaの世界を予想する -Java EE7/クラウド/Docker/etc.-
 
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送
 
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送
 
ネットワーク自動化の課題 - グラフデータベースによる解決
ネットワーク自動化の課題 - グラフデータベースによる解決ネットワーク自動化の課題 - グラフデータベースによる解決
ネットワーク自動化の課題 - グラフデータベースによる解決
 
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsPL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
 
[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築
[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築
[Developers Summit 2018] Microsoft AIプラットフォームによるインテリジェント アプリケーションの構築
 
Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18Microsoft open tech night 2020 feb18
Microsoft open tech night 2020 feb18
 
アプリを成長させるためのログ取りとログ解析に必要なこと
アプリを成長させるためのログ取りとログ解析に必要なことアプリを成長させるためのログ取りとログ解析に必要なこと
アプリを成長させるためのログ取りとログ解析に必要なこと
 
Redshift Spectrumを使ってみた話
Redshift Spectrumを使ってみた話Redshift Spectrumを使ってみた話
Redshift Spectrumを使ってみた話
 
ソフトウェアが可能する新しいネッワークの 未来と提供する価値:ユースケース
ソフトウェアが可能する新しいネッワークの 未来と提供する価値:ユースケースソフトウェアが可能する新しいネッワークの 未来と提供する価値:ユースケース
ソフトウェアが可能する新しいネッワークの 未来と提供する価値:ユースケース
 
Tech Dojo 02/09 IBM Japan CSM
Tech Dojo 02/09 IBM Japan CSMTech Dojo 02/09 IBM Japan CSM
Tech Dojo 02/09 IBM Japan CSM
 
Airflowを広告データのワークフローエンジンとして運用してみた話
Airflowを広告データのワークフローエンジンとして運用してみた話Airflowを広告データのワークフローエンジンとして運用してみた話
Airflowを広告データのワークフローエンジンとして運用してみた話
 
第3回 配信講義 計算科学技術特論B(2022)
第3回 配信講義 計算科学技術特論B(2022)第3回 配信講義 計算科学技術特論B(2022)
第3回 配信講義 計算科学技術特論B(2022)
 
Aerospike deep dive LDTs
Aerospike deep dive LDTsAerospike deep dive LDTs
Aerospike deep dive LDTs
 
C base design methodology with s dx and xilinx ml
C base design methodology with s dx and xilinx ml C base design methodology with s dx and xilinx ml
C base design methodology with s dx and xilinx ml
 
LoRaWANとAzure IoT Hub接続ハンズオン
LoRaWANとAzure IoT Hub接続ハンズオンLoRaWANとAzure IoT Hub接続ハンズオン
LoRaWANとAzure IoT Hub接続ハンズオン
 
トレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するトレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解する
 
Lambda in template_final
Lambda in template_finalLambda in template_final
Lambda in template_final
 
20181212 - PGconf.ASIA - LT
20181212 - PGconf.ASIA - LT20181212 - PGconf.ASIA - LT
20181212 - PGconf.ASIA - LT
 

More from Masahiko Umeno

RHF2021_ポイントは業務視点.pdf
RHF2021_ポイントは業務視点.pdfRHF2021_ポイントは業務視点.pdf
RHF2021_ポイントは業務視点.pdfMasahiko Umeno
 
資料用_B1_mumeno_RHF_2014_wo_pic.pdf
資料用_B1_mumeno_RHF_2014_wo_pic.pdf資料用_B1_mumeno_RHF_2014_wo_pic.pdf
資料用_B1_mumeno_RHF_2014_wo_pic.pdfMasahiko Umeno
 
Why we should consider Open Hybrid Cloud.pdf
Why we should  consider Open Hybrid Cloud.pdfWhy we should  consider Open Hybrid Cloud.pdf
Why we should consider Open Hybrid Cloud.pdfMasahiko Umeno
 
Open Hybrid Cloudを検討すべき理由.pdf
Open Hybrid Cloudを検討すべき理由.pdfOpen Hybrid Cloudを検討すべき理由.pdf
Open Hybrid Cloudを検討すべき理由.pdfMasahiko Umeno
 
Rhf2019 how totackle barriersofapplicationmodernization_ap16_en
Rhf2019 how totackle barriersofapplicationmodernization_ap16_enRhf2019 how totackle barriersofapplicationmodernization_ap16_en
Rhf2019 how totackle barriersofapplicationmodernization_ap16_enMasahiko Umeno
 
Application Modernizationの障壁にどう取り組むか
Application Modernizationの障壁にどう取り組むかApplication Modernizationの障壁にどう取り組むか
Application Modernizationの障壁にどう取り組むかMasahiko Umeno
 
Next generation business automation with the red hat decision manager and red...
Next generation business automation with the red hat decision manager and red...Next generation business automation with the red hat decision manager and red...
Next generation business automation with the red hat decision manager and red...Masahiko Umeno
 
Master the RETE algorithm
Master the RETE algorithmMaster the RETE algorithm
Master the RETE algorithmMasahiko Umeno
 
Business Resource Planner (RHF2017 Tokyo)
Business Resource Planner (RHF2017 Tokyo)Business Resource Planner (RHF2017 Tokyo)
Business Resource Planner (RHF2017 Tokyo)Masahiko Umeno
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial IntelligenceMasahiko Umeno
 
レッドハットのベストプラクティス
レッドハットのベストプラクティスレッドハットのベストプラクティス
レッドハットのベストプラクティスMasahiko Umeno
 
Red Hat Forum 2015 Tokyo mumeno 公開資料
Red Hat Forum 2015 Tokyo mumeno 公開資料Red Hat Forum 2015 Tokyo mumeno 公開資料
Red Hat Forum 2015 Tokyo mumeno 公開資料Masahiko Umeno
 
Application Architecture -Data, Process, Rule-
Application Architecture -Data, Process, Rule-Application Architecture -Data, Process, Rule-
Application Architecture -Data, Process, Rule-Masahiko Umeno
 

More from Masahiko Umeno (15)

RHF2021_ポイントは業務視点.pdf
RHF2021_ポイントは業務視点.pdfRHF2021_ポイントは業務視点.pdf
RHF2021_ポイントは業務視点.pdf
 
資料用_B1_mumeno_RHF_2014_wo_pic.pdf
資料用_B1_mumeno_RHF_2014_wo_pic.pdf資料用_B1_mumeno_RHF_2014_wo_pic.pdf
資料用_B1_mumeno_RHF_2014_wo_pic.pdf
 
Why we should consider Open Hybrid Cloud.pdf
Why we should  consider Open Hybrid Cloud.pdfWhy we should  consider Open Hybrid Cloud.pdf
Why we should consider Open Hybrid Cloud.pdf
 
Open Hybrid Cloudを検討すべき理由.pdf
Open Hybrid Cloudを検討すべき理由.pdfOpen Hybrid Cloudを検討すべき理由.pdf
Open Hybrid Cloudを検討すべき理由.pdf
 
Rhf2019 how totackle barriersofapplicationmodernization_ap16_en
Rhf2019 how totackle barriersofapplicationmodernization_ap16_enRhf2019 how totackle barriersofapplicationmodernization_ap16_en
Rhf2019 how totackle barriersofapplicationmodernization_ap16_en
 
Application Modernizationの障壁にどう取り組むか
Application Modernizationの障壁にどう取り組むかApplication Modernizationの障壁にどう取り組むか
Application Modernizationの障壁にどう取り組むか
 
Next generation business automation with the red hat decision manager and red...
Next generation business automation with the red hat decision manager and red...Next generation business automation with the red hat decision manager and red...
Next generation business automation with the red hat decision manager and red...
 
Master the RETE algorithm
Master the RETE algorithmMaster the RETE algorithm
Master the RETE algorithm
 
Business Resource Planner (RHF2017 Tokyo)
Business Resource Planner (RHF2017 Tokyo)Business Resource Planner (RHF2017 Tokyo)
Business Resource Planner (RHF2017 Tokyo)
 
BRMS6.2 2016版
BRMS6.2 2016版BRMS6.2 2016版
BRMS6.2 2016版
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
レッドハットのベストプラクティス
レッドハットのベストプラクティスレッドハットのベストプラクティス
レッドハットのベストプラクティス
 
Red Hat Forum 2015 Tokyo mumeno 公開資料
Red Hat Forum 2015 Tokyo mumeno 公開資料Red Hat Forum 2015 Tokyo mumeno 公開資料
Red Hat Forum 2015 Tokyo mumeno 公開資料
 
Opta planner勉強会
Opta planner勉強会Opta planner勉強会
Opta planner勉強会
 
Application Architecture -Data, Process, Rule-
Application Architecture -Data, Process, Rule-Application Architecture -Data, Process, Rule-
Application Architecture -Data, Process, Rule-
 

RETEアルゴリズムを使いこなせ

  • 2. ルールエンジンとは… Copyright © 2018 Red Hat K.K. All Rights Reserved.2 いろいろな種類のデータの関連性から、新しいアクションを起こす変換器 例えば… 通信手段 いちご味を多く買っている人へ よく閲覧している時間に 好みの通信手段で広告を打つ購買履歴 12:13 閲覧履歴
  • 3. 本日の内容 Copyright © 2018 Red Hat K.K. All Rights Reserved.3 RETE アルゴリズム 基本的な 動作 機械学習 への応用
  • 4. RETE アルゴリズム Copyright © 2018 Red Hat K.K. All Rights Reserved.4 プロダクションシステムを実現するために考えられた、 効率的なパターンマッチングアルゴリズム プロダクションシステム:自動計画・エキスパートシステム・行動選択 知識データ 行動
  • 5. ルールエンジンの歴史 Copyright © 2018 Red Hat K.K. All Rights Reserved.5 Mycin Dendral 1972 エキスパートシステムからスタート Prolog RETE 1974 OPS5 CLIPS Jess DroolsSoar ILOG Rules 1984 1983 1995 2001 1987 JBoss Enterprise BRMS 5 2009 現在 1996 Red Hat JBoss BRMS 6 RETE 誕生
  • 6. ルールエンジンの構造 Copyright © 2018 Red Hat K.K. All Rights Reserved.6 ワーキングメモリー プロダクションメモリー アジェンダ データ (Fact) が入るところ データとルールがマッチングした実行候補 (Activation) が入るところ 知識 (Rule) が入るところ
  • 8. トラックと運転手のマッチング Copyright © 2017 Red Hat K.K. All Rights Reserved.8 ルール • 壊れたトラックと修理部品がある場合、修理する。 • 乗れるトラックと運転手がいる場合、乗車する。 ルールエンジンを使用することで、どのような処理の流れになるか? All pictures drawn by Nagisa.
  • 9. Step 1/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.9 ワーキングメモリー プロダクションメモリー アジェンダ 条件 アクション 条件 アクション
  • 10. Step 2/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.10 ワーキングメモリー 条件 アクション 条件 アクション プロダクションメモリー アジェンダ 条件 アクション
  • 11. Step 3/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.11 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 12. Step 4/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.12 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 13. Step 5/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.13 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 14. Step 6/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.14 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 15. Step 7/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.15 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 16. Step 8/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.16 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 17. Step 9/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.17 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 18. Step 10/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.18 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 19. Step 11/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.19 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 20. Step 12/12 Copyright © 2017 Red Hat K.K. All Rights Reserved.20 ワーキングメモリー アジェンダ 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション 条件 アクション プロダクションメモリー
  • 21. データモデル (Fact) Copyright © 2012 Red Hat, Inc. public class Truck { private String Color; private String Parts; private String Driver; } public class Parts { private String Parts; } public class Driver { private String Name; } 21 データモデルを考えます。 トラックの属性値として何がある か等を考慮して、クラスとメン バーを作成していきます。
  • 22. ルール Copyright © 2012 Red Hat, Inc. rule "Repear" salience 100 when p : Parts () t : Truck (parts == p.parts ) then t.setParts ("Complete"); retract (p); update (t); end rule "Matching" salience 10 when t : Truck (parts == "Complete", driver == "") d : Driver (n : name ) then t.setDriver (n); retract (d); update (t); end 22 Update (x); Fact xに変更があったことをルールエンジン に通知する。ルールエンジンは新しくなった Fact でルールを再評価し、マッチすればア ジェンダにActivationを作る。 Retract (x); ワーキングメモリーからFact x を消去する。 消去されたことによりアジェンダから Activationを消去する。
  • 24. RETEアルゴリズムの特性 Copyright © 2018 Red Hat K.K. All Rights Reserved.24 • オブジェクト(Factとルール、FactとFactとルール等) の関係性より、アクションを起こすエンジン • Factが更新され、ルールエンジンに通知すると、再評価 が行われ、その時にマッチしたオブジェクトとルールの 組み合わせで逐次実行される • 組合せ爆発に弱い • 無限ループは検知できない – ルールの実行回数で判断し中止することが可能
  • 25. PHREAK Copyright © 2018 Red Hat K.K. All Rights Reserved.25 • (Marc) Proctor’s Hybrid Reasoning Engine for Advanced Knowledge – RETEOO(RETE Object Oriented)を改良したもの • 遅延評価 – 一気に評価をするのではなく、Agendaでの組合せ爆発を 防ぐ(条件が多段の場合) • 高速化 – 評価部分のマルチスレッド化 – 実行部分のマルチスレッド化
  • 26. RETE アルゴリズムを有効に活用できる業務 Copyright © 2018 Red Hat K.K. All Rights Reserved.26 機能 内容 相関チェック 業務観点 申込審査・査定・対象の導出・DBのデータ品質のチェック等 システム 観点 階層化・分散されたデータの相関チェック 集計処理 業務観点 代理店インセンティブ計算・費目ごとの集計やシミュレー ション システム 観点 階層化・分散されたデータの計算・集計 推論 業務観点 生産管理・工程計画・ルーティング システム 観点 前向き推論・後ろ向き推論・Truth Maintenance System
  • 27. Red Hat Decision Managerのルールエンジン Copyright © 2018 Red Hat K.K. All Rights Reserved.27 • データに基づきルールが評価される • 推論機構にて連続発火し、再評価を行うことで、複雑な ロジックでもシンプルに作ることができる • 実行結果のトレースがとれるので、ブラックボックス化 しない • RETEアルゴリズムの進化版の PHREAKを搭載 • 単なるif-thenのエンジンではない!
  • 29. 人工知能における学習の種類 Copyright © 2018 Red Hat K.K. All Rights Reserved.29 教師あり 機械学習 教師なし 機械学習 人間の手打ち による学習 ビジネスルール 教師あり学習 • ニューラルネットワーク • 回帰 • Tree • 単純ベイズ • クラスタリング k近傍法 教師なし学習 • 主成分分析 • クラスタリング k平均法 • ベクトル量子化 • 自己組織化マップ
  • 30. クラスタリング Copyright © 2018 Red Hat K.K. All Rights Reserved.30 • 機械学習の一つ • 原始的だが重要な手法 • データマイニングなどでよく使われている • 答えは「場合分け」 • 答えを「教師あり学習」「ルール」として使う • 非階層的手法:k平均法 • 階層化手法:最短距離法・最長距離法・群平均法…
  • 31. 最短距離法の手順 Copyright © 2018 Red Hat K.K. All Rights Reserved.31 1. 任意の2つのオブジェクトの距離を計算 2. 任意の2つのオブジェクトのうち、一番小さな距離間 のオブジェクトを抽出し、その重心を新たにオブジェ クトとして作成する。新しいオブジェクトと、2つの オブジェクトの関係性を記録する。 3. オブジェクトは複数のグループに所属出来ないので、 異なるグループに所属している場合はどちらかのグ ループに属することを諦める 4. オブジェクトの総数が希望するクラスタ数よりも多い 場合、1-4を繰り返す。
  • 33. データ Copyright © 2018 Red Hat K.K. All Rights Reserved.33 7 8 18 27 37.5 62 72 73 89 96 • 0〜100の数値 • 点の数は10個(重複もありうる) • ランダムにプロット 3つに分類する
  • 34. 最終目標 Copyright © 2018 Red Hat K.K. All Rights Reserved.34 7.5 92.526.25 67.25 15 37.5 22.5 62 72.5 18 27 89 967 8 72 73
  • 35. データモデル (Fact) Copyright © 2018 Red Hat K.K. All Rights Reserved.35 public class Distance { private double distance; private AnalysisData a1; private AnalysisData a2; } 2点間のオブジェクトとその距離 public class AnalysisData { private double x; private double y; private String Tag=""; private int Color=0; private int level=0; private ArrayList<AnalysisData> subsidiary;} クラスタリングするデータ 座標と幾つかの識別フラグ、 自分がどのデータに含まれるかのリスト
  • 36. 作成したルール Copyright © 2018 Red Hat K.K. All Rights Reserved.36 rule “2点間の距離を計算” rule “最小の距離を抽出し、新しい重心を作成” rule “子が重複したクラスタを取り除き、子にならないものを子から外す” rule “クラスタ数をチェックし、距離情報を削除” rule “最上階層の色付け” rule “その他の階層は最上階層の色とする" クラスタリング 色付け
  • 37. Copyright © 2018 Red Hat K.K. All Rights Reserved.37 rule "2点間の距離を計算" salience 100 when ad1: AnalysisData(x1:x , y1:y, tag =="") ad2: AnalysisData(x2:x >=x1 , y2:y, tag =="", this != ad1) not Distance(a1==ad1, a2==ad2) not Distance(a1==ad2, a2==ad1) then Distance d = new Distance(); d.setDistance(Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2))); d.setA1(ad1); d.setA2(ad2); insert (d); end tag:自分が子となった場合にChildとする 距離の計算はユークリッド距離を使用
  • 38. Copyright © 2018 Red Hat K.K. All Rights Reserved.38 rule “最小の距離を抽出し、新しい重心を作成" salience 100 when d1 : Distance( minDist:distance ) not Distance( distance < minDist) A1 : AnalysisData( tag =="") from d1.getA1 A2 : AnalysisData( tag =="") from d1.getA2 NumberOfCluster( number > CulsterNumber ) then AnalysisData ad = new AnalysisData(); ad.setX((d1.getA1().getX()+d1.getA2().getX())/2); ad.setY((d1.getA1().getY()+d1.getA2().getY())/2); ad.setTag(""); ad.setLevel(1); ad.addSubsidiary(d1.getA1()); ad.addSubsidiary(d1.getA2()); insert(ad); A1.setTag(“Child”); update(A1); A2.setTag(“Child”); update(A2); retract(d1); end tag:自分が子となった場合にChildとする 自分の距離より小さいものがない = 自分自身は最小 Level:階層化されたフラグ (初期値は0) 新しい重心を作成 (元データと同じデータ型) 新しい重心ができたことをルールエンジンに通知
  • 39. Copyright © 2018 Red Hat K.K. All Rights Reserved.39 rule "子が重複したクラスタを取り除き、子にならないものを子から外す" salience 200 when ad1: AnalysisData( ) ad2: AnalysisData( tag =="", subsidiary contains ad1) ad3: AnalysisData( this != ad2, subsidiary contains ad1) ad4: AnalysisData( this != ad1 ) from ad3.getSubsidiary() ad5: AnalysisData( this != ad1, this != ad4) from ad2.getSubsidiary() then ad4.setTag(""); retract (ad3); update(ad4); end
  • 40. Copyright © 2018 Red Hat K.K. All Rights Reserved.40 rule “クラスタ数をチェックし、距離情報を消し、再評価のきっかけを作る" salience -100 when total: Number(intValue >= CulsterNumber.intValue()) from accumulate (AD: AnalysisData( tag != "Child"), count(AD)) noc: NumberOfCluster() d: Distance() then noc.setNumber(total.intValue()); update (noc); retract (d); end Tagが Childでないものが、クラスタのParentノード 分割したい数 C CC C
  • 41. Step 1 Copyright © 2018 Red Hat K.K. All Rights Reserved.41 7 8 18 27 37.5 62 72 73 89 96
  • 42. Step 1 Copyright © 2018 Red Hat K.K. All Rights Reserved.42 7 8 18 27 37.5 62 72 73 89 96 1 10 9 11 24 10 1 16 7 7.5 72.518 27 37.5 62 89 96 分類数:8
  • 43. Step 2 Copyright © 2018 Red Hat K.K. All Rights Reserved.43 18 27 37.5 62 89 967.5 72.5 11.5 24 10.5 16.5 79 11 92.518 27 37.5 62 72.57.5 分類数:7
  • 44. Step 3 Copyright © 2018 Red Hat K.K. All Rights Reserved.44 18 27 37.5 627.5 72.5 92.5 11.5 24 10.59 11 20 37.5 62 72.57.5 92.522.5 分類数:6
  • 45. Step 4 Copyright © 2018 Red Hat K.K. All Rights Reserved.45 37.5 627.5 72.5 92.5 15 24 10.515 20 22.5 37.57.5 92.522.5 67.25 分類数:5
  • 46. Step5 Copyright © 2018 Red Hat K.K. All Rights Reserved.46 37.57.5 92.5 15 15 29.7515 25.25 22.5 30 67.25 92.567.25 分類数:4
  • 47. Copyright © 2018 Red Hat K.K. All Rights Reserved.47 rule "子が重複したクラスタを取り除き、子にならないものを子から外す" salience 200 when ad1: AnalysisData( ) ad2: AnalysisData( tag =="", subsidiary contains ad1) ad3: AnalysisData( this != ad2, subsidiary contains ad1) ad4: AnalysisData( this != ad1 ) from ad3.getSubsidiary() ad5: AnalysisData( this != ad1, this != ad4) from ad2.getSubsidiary () then ad4.setTag(""); retract (ad3); update(ad4); end 37.57.5 15 15 15 22.5 30 ad4 ad2 ad1 ad3 ad5
  • 48. Copyright © 2018 Red Hat K.K. All Rights Reserved.48 rule "子が重複したクラスタを取り除き、子にならないものを子から外す" salience 200 when ad1: AnalysisData( ) ad2: AnalysisData(this != ad1) ad3: AnalysisData(this != ad1, this != ad2) ad4: AnalysisData(tag =="", subsidiary contains ad1, subsidiary contains ad2) ad5: AnalysisData(tag =="", this != ad4, subsidiary contains ad2, subsidiary contains ad3) then ad3.setTag(""); update(ad3); retract (ad5); end 37.57.5 15 15 15 22.5 30 ad3 ad4 ad2 ad5 ad1 Bad! 500C3 = 2,070万
  • 49. Step5 Copyright © 2018 Red Hat K.K. All Rights Reserved.49 37.57.5 92.5 15 29.7515 25.25 22.5 67.25 92.567.2515 30 分類数:4 307.5 22.5
  • 50. Step6 Copyright © 2018 Red Hat K.K. All Rights Reserved.50 92.5 26.25 22.5 29.75 25.25 67.25 92.567.25 分類数:3 15 37.5
  • 51. Step7 階層化表示 Copyright © 2018 Red Hat K.K. All Rights Reserved.51 7.5 92.526.25 67.25 15 37.5 22.5 62 72.5 18 27 89 967 8 72 73
  • 52. Step7 階層化表示 Copyright © 2018 Red Hat K.K. All Rights Reserved.52 7.5 92.526.25 67.25 15 37.5 22.5 62 72.5 18 27 89 967 8 72 73
  • 53. K-平均法の手順 Copyright © 2018 Red Hat K.K. All Rights Reserved.53 1. データに分類したいラベルを付ける。(Randomに) 2. それぞれのラベルの重心を求める。 3. データとラベルの距離を計算し、一番近いラベルをつ け直す。 4. 重心の位置が動かなくなるまで2-3を繰り返す。
  • 54. K-平均法 Copyright © 2018 Red Hat K.K. All Rights Reserved.54 7 8 18 27 37.5 62 72 73 89 96 50.5 39.5 56.3 7 8 18 27 37.5 62 72 73 89 96 19.5 50.5 78.4 7 8 18 27 37.5 62 72 73 89 96 15.0 49.75 82.5 7 8 18 27 37.5 62 72 73 89 96
  • 55. Copyright © 2018 Red Hat K.K. All Rights Reserved.55 7 8 18 27 37.5 62 72 73 89 96 k-平均法による結果 7 8 18 27 37.5 62 72 73 89 96 最短距離法による結果 どちらの方式がより人間の感覚に近い?
  • 57. オリジナル Copyright © 2018 Red Hat K.K. All Rights Reserved.57 • X値 y値ともに、0〜10,000の数値 • 点の数は500個(重複もありうる) • ランダムにプロット
  • 58. 3クラスタ Copyright © 2018 Red Hat K.K. All Rights Reserved.58
  • 59. 5クラスタ Copyright © 2018 Red Hat K.K. All Rights Reserved.59
  • 60. 10クラスタ Copyright © 2018 Red Hat K.K. All Rights Reserved.60
  • 61. 15クラスタ Copyright © 2018 Red Hat K.K. All Rights Reserved.61
  • 63. まとめ Copyright © 2018 Red Hat K.K. All Rights Reserved.63 • ルールエンジンは単なるIf-Thenのエンジンではない! • RETEアルゴリズムは、繰り返し処理や複雑な動きを再 評価・実行することで、ルールを簡単に書ける仕組みで ある • ルールはオブジェクトの組み合わせを常に意識して書く • 機械学習にも使える!
  • 64. Decision Manager 関連セッション Copyright © 2018 Red Hat K.K. All Rights Reserved.64
  • 65. Copyright © 2018 Red Hat K.K. All Rights Reserved.65 17:35 アイデアソン表彰式 https://jp-redhat.com/forum-ideathon/