Association Rules
Association Ruleモデルの属性定義は、値が、同じタイプの要素の集合(同一のXMLドキュメントに含まれる)の中で一意でなければならないという意味論的制約を表\現するために、エンティティELEMENT-IDを使います。
<!ENTITY %ELEMENT-ID "CDATA"> |
Association Ruleモデルは4つの大きな部分から成ります:
<!ELEMENT AssociationModel (Extension*, MiningSchema, Item+, Itemset+, AssociationRule+, Extension*)> <!ATTLIST AssociationModel modelName CDATA #IMPLIED functionName %MINING-FUNCTION; #REQUIRED algorithmName CDATA #IMPLIED numberOfTransactions %INT-NUMBER; #REQUIRED maxNumberOfItemsPerTA %INT-NUMBER; #IMPLIED avgNumberOfItemsPerTA %REAL-NUMBER; #IMPLIED minimumSupport %PROB-NUMBER; #REQUIRED minimumConfidence %PROB-NUMBER; #REQUIRED lengthLimit %INT-NUMBER; #IMPLIED numberOfItems %INT-NUMBER; #REQUIRED numberOfItemsets %INT-NUMBER; #REQUIRED numberOfRules %INT-NUMBER; #REQUIRED > |
属性記述(Attribute description):
numberOfTransactions:入力データに含まれていたトランザクション(アイテムのかご)の数。
maxNumberOfItemsPerTA:最大のトランザクションに含まれていたアイテムの数。
avgNumberOfItemsPerTA:トランザクションに含まれていたアイテムの平均数。
minimumSupport:すべての規則によって満たされた最小の相対的サポート値(#supporting transactions / #total transactions)。
minimumConfidence:すべての規則によって満たされた最小の信頼度(confidence value)。確信は(support (rule) / support(antecedent))として計算されます。
lengthLimit:規則の数を制限するために使われる規則に含まれていたアイテムの最大の数。
numberOfItems:入力データに含まれていた異なるアイテムの数。
numberOfItemsets:モデルに含まれていたアイテム集合(itemsets)の数。
numberOfRules:モデルに含まれていた規則の数。
アイテム集合(itemsets)に含まれていたアイテム:
<!ELEMENT Item EMPTY> <!ATTLIST Item id %ELEMENT-ID; #REQUIRED value CDATA #REQUIRED mappedValue CDATA #IMPLIED weight %REAL-NUMBER; #IMPLIED > |
属性記述(Attribute description):
id:アイテムを一意に識別する識別子(identification)。
value:入力データに入るようなアイテムの値。
mappedValue:オプション、オリジナルのアイテム値が写像される値。
○例えば、オリジナルの値がEANまたはSKUのコードなら、これは製品名が相当します。
weight:アイテムの重さ。例えばアイテムの価格や値。
規則に含まれているItemsets
<!ELEMENT Itemset (Extension*, ItemRef+)> <!ATTLIST Itemset id %ELEMENT-ID; #REQUIRED support %PROB-NUMBER; #IMPLIED numberOfItems %INT-NUMBER; #IMPLIED > |
属性記述(Attribute description):
id:itemsetを一意に識別する識別子(identification)。
support:itemsetの相対的なサポート
numberOfItems:このitemsetに含まれていたアイテムの数
Subelements:タイプ・アイテムの要素への点へのアイテム参照。
<!ELEMENT ItemRef EMPTY> <!ATTLIST ItemRef itemRef %ELEMENT-ID; #REQUIRED > |
属性記述(Attribute description):
itemRef:アイテム要素のid値
Rules:formの要素
<antecedent itemset> => <consequent itemset>
<!ELEMENT AssociationRule ( Extension* )> <!ATTLIST AssociationRule support %PROB-NUMBER; #REQUIRED confidence %PROB-NUMBER; #REQUIRED antecedent %ELEMENT-ID; #REQUIRED consequent %ELEMENT-ID; #REQUIRED > |
属性定義(Attribute definitions):
support:規則の相対的なサポート
confidence : 規則の信頼度
antecedent : 規則の前提(antecedent)であるitemsetのid値
consequent : 規則の結果(consequent)であるitemsetのid値
例:
私たちが次のデータをもつ4つのトランザクションを行っていると仮定しましょう:
t1: クラッカー、コーラ、水
t2: クラッカー、水
t3: クラッカー、水
t4: クラッカー、コーラ、水
<?xml version="1.0" ?>
<PMML version="2.0" >
<Header copyright="www.dmg.org"
description="example model for association rules"/>
<DataDictionary numberOfFields="2" >
<DataField name="transaction" optype="categorical" />
<DataField name="item" optype="categorical" />
</DataDictionary>
<AssociationModel
functionName="associationRules"
numberOfTransactions="4" numberOfItems="3"
minimumSupport="0.6" minimumConfidence="0.5"
numberOfItemsets="3" numberOfRules="2">
<MiningSchema>
<MiningField name="transaction"/>
<MiningField name="item"/>
</MiningSchema>
<!-- We have three items in our input data -->
<Item id="1" value="Cracker" />
<Item id="2" value="Coke" />
<Item id="3" value="Water" />
<!-- and two frequent itemsets with a single item -->
<Itemset id="1" support="1.0" numberOfItems="1">
<ItemRef itemRef="1" />
</Itemset>
<Itemset id="2" support="1.0" numberOfItems="1">
<ItemRef itemRef="3" />
</Itemset>
<!-- and one frequent itemset with two items. -->
<Itemset id="3" support="1.0" numberOfItems="2">
<ItemRef itemRef="1" />
<ItemRef itemRef="3" />
</Itemset>
<!-- Two rules satisfy the requirements -->
<AssociationRule support="1.0" confidence="1.0"
antecedent="1" consequent="2" />
<AssociationRule support="1.0" confidence="1.0"
antecedent="2" consequent="1" />
</AssociationModel>
</PMML>
|
