Class PMMLAssociationModel

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
  • Constructor Details

    • PMMLAssociationModel

      public PMMLAssociationModel(PMMLModelSpec spec)
      Construct a PMMLAssociationObject from the given specification.
      Parameters:
      spec - input specification
    • PMMLAssociationModel

      public PMMLAssociationModel(Document document)
      Construct a PMMLAssociationObject from the given PMML represented as an XML DOM.
      Parameters:
      document - input PMML model
  • Method Details

    • 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 class PMMLModel
      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 class PMMLModel
      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 class PMMLModel
      Parameters:
      modelElem - root element of model object