- java.lang.Object
-
- com.pervasive.datarush.analytics.pmml.PMMLModel
-
- com.pervasive.datarush.analytics.arm.PMMLAssociationModel
-
public class PMMLAssociationModel extends PMMLModel
Captures the information required to build a PMML Association model. An association model requires a list of items with mappings to item names from the input. It also contains frequent item sets and association rules.The frequent item sets contain references to items contained in the item list. The association rules contain references to the defined item sets.
Due to the way the model is defined, the model should be built in this order:
- Item list
- Frequent item sets
- Association rules
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.pervasive.datarush.analytics.pmml.PMMLModel
PMMLModel.MiningFunction
-
-
Constructor Summary
Constructors Constructor Description PMMLAssociationModel(PMMLModelSpec spec)
Construct aPMMLAssociationObject
from the given specification.PMMLAssociationModel(Document document)
Construct aPMMLAssociationObject
from the given PMML represented as an XML DOM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAssociationRule(AssociationRule rule)
Add an association rule to the model.void
addItem(Item item)
Add an item to the model.void
addItemSet(ItemSet itemSet)
Add an item set to the model.protected void
buildModelElement(Element modelElem)
Subclasses must implement this method to fill-in the contents of the model element.String
getAlgorithmName()
Get the algorithm name.double
getAvgItemsPerTxn()
Get the average items per transaction value.Map<Integer,String>
getItemLabelMap()
Create a mapping from item identifier to item label of the items contained in this model.Map<Integer,String>
getItemNameMap()
Create a mapping from item identifier to item name of the items contained in this model.List<Item>
getItems()
Return the list of items contained in the model.List<ItemSet>
getItemSets()
Return the list of frequent item sets contained in the model.int
getMaxItemsPerTxn()
Get the maximum items per transaction value.double
getMinConfidence()
Get the minimum confidence setting.double
getMinSupport()
Get the minimum support setting.protected String
getModelElementName()
Return the element name of the primary model element associated with this PMMLList<AssociationRule>
getRules()
Return the list of association rules contained in the model.long
getTxnCount()
Get the transaction count value.protected void
parseModelElement(Element modelElem)
Parse the given model element into the respective model object.void
setAlgorithmName(String algorithmName)
Set the name of the algorithm used to generate the association model.void
setAvgItemsPerTxn(double avgItemsPerTxn)
Set the average items per transaction value.void
setMaxItemsPerTxn(int maxItemsPerTxn)
Set the maximum items per transaction value.void
setMinConfidence(double minConfidence)
Set the minimum confidence used to generate the rules within this association model.void
setMinSupport(double minSupport)
Set the minimum support setting.void
setTxnCount(long txnCount)
Set the transaction count value.-
Methods inherited from class com.pervasive.datarush.analytics.pmml.PMMLModel
findModelElement, getAnnotationText, getModelExplanation, getModelSpec, getVersion, parse, setAnnotationText, setModelExplanation, setVersion, toPMML
-
-
-
-
Constructor Detail
-
PMMLAssociationModel
public PMMLAssociationModel(PMMLModelSpec spec)
Construct aPMMLAssociationObject
from the given specification.- Parameters:
spec
- input specification
-
PMMLAssociationModel
public PMMLAssociationModel(Document document)
Construct aPMMLAssociationObject
from the given PMML represented as an XML DOM.- Parameters:
document
- input PMML model
-
-
Method Detail
-
getTxnCount
public long getTxnCount()
Get the transaction count value.- Returns:
- transaction count
-
setTxnCount
public void setTxnCount(long txnCount)
Set the transaction count value.- Parameters:
txnCount
- transaction count
-
getMinSupport
public double getMinSupport()
Get the minimum support setting.- Returns:
- minimum support
-
setMinSupport
public void setMinSupport(double minSupport)
Set the minimum support setting.- Parameters:
minSupport
- minimum support
-
getMaxItemsPerTxn
public int getMaxItemsPerTxn()
Get the maximum items per transaction value.- Returns:
- maximum items per transaction
-
setMaxItemsPerTxn
public void setMaxItemsPerTxn(int maxItemsPerTxn)
Set the maximum items per transaction value.- Parameters:
maxItemsPerTxn
- maximum items per transaction
-
getAvgItemsPerTxn
public double getAvgItemsPerTxn()
Get the average items per transaction value.- Returns:
- average items per transaction
-
setAvgItemsPerTxn
public void setAvgItemsPerTxn(double avgItemsPerTxn)
Set the average items per transaction value.- Parameters:
avgItemsPerTxn
- average items per transaction
-
getAlgorithmName
public String getAlgorithmName()
Get the algorithm name.- Returns:
- algorithm name
-
getMinConfidence
public double getMinConfidence()
Get the minimum confidence setting.- Returns:
- minimum confidence
-
setMinConfidence
public void setMinConfidence(double minConfidence)
Set the minimum confidence used to generate the rules within this association model.- Parameters:
minConfidence
- minimum confidence value
-
setAlgorithmName
public void setAlgorithmName(String algorithmName)
Set the name of the algorithm used to generate the association model. This is an opaque value within the model but useful to help determine how the model was created.- Parameters:
algorithmName
- the name of the algorithm used
-
addItem
public final void addItem(Item item)
Add an item to the model. The given name will be mapped to the given identifier.- Parameters:
item
- the item to add to the model
-
getItems
public List<Item> getItems()
Return the list of items contained in the model.- Returns:
- frequent items
-
getItemNameMap
public Map<Integer,String> getItemNameMap()
Create a mapping from item identifier to item name of the items contained in this model.- Returns:
- mapping from item identifier to item name
-
getItemLabelMap
public Map<Integer,String> getItemLabelMap()
Create a mapping from item identifier to item label of the items contained in this model.- Returns:
- mapping from item identifier to item label
-
getItemSets
public List<ItemSet> getItemSets()
Return the list of frequent item sets contained in the model.- Returns:
- frequent item sets
-
getRules
public List<AssociationRule> getRules()
Return the list of association rules contained in the model.- Returns:
- association rules
-
addItemSet
public void addItemSet(ItemSet itemSet)
Add an item set to the model. Items contained within the set must be contained within the list of items provided. The set includes a support value.- Parameters:
itemSet
- the item set to add to the model
-
addAssociationRule
public void addAssociationRule(AssociationRule rule)
Add an association rule to the model. The antecedent and consequent of the rule are item sets. The item sets must already be contained within the model.- Parameters:
rule
- an association rule to add to the model
-
getModelElementName
protected String getModelElementName()
Description copied from class:PMMLModel
Return the element name of the primary model element associated with this PMML- Specified by:
getModelElementName
in classPMMLModel
- Returns:
- the element name of the primary model element
-
buildModelElement
protected void buildModelElement(Element modelElem)
Description copied from class:PMMLModel
Subclasses must implement this method to fill-in the contents of the model element. At the time this method is invoked, the element will have its name and MiningSchema sub-element populated.- Specified by:
buildModelElement
in classPMMLModel
- Parameters:
modelElem
- the model element
-
parseModelElement
protected void parseModelElement(Element modelElem)
Description copied from class:PMMLModel
Parse the given model element into the respective model object.- Specified by:
parseModelElement
in classPMMLModel
- Parameters:
modelElem
- root element of model object
-
-