java.lang.Object
adaa.analytics.rules.logic.representation.Knowledge
All Implemented Interfaces:
Serializable

public class Knowledge extends Object implements Serializable
Class representing user's knowledge.
See Also:
  • Field Details

    • extendUsingPreferred

      protected boolean extendUsingPreferred
      Flag indicating if initial (user's) rules should be extended with preferred conditions/attributes.
    • extendUsingAutomatic

      protected boolean extendUsingAutomatic
      Flag indicating if initial (user's) rules should be extended with automatic conditions/attributes.
    • induceUsingPreferred

      protected boolean induceUsingPreferred
      Flag indicating if new rules should be induced with preferred conditions and attributes.
    • induceUsingAutomatic

      protected boolean induceUsingAutomatic
      Flag indicating if new rules should be induced with automatic conditions.
    • considerOtherClasses

      protected boolean considerOtherClasses
      Flag indicating whether automatic induction should be performed for classes for which no user's requirements have been defined (classification problems only) .
    • preferredConditionsPerRule

      protected int preferredConditionsPerRule
      Maximum number of preferred conditions per rule.
    • preferredAttributesPerRule

      protected int preferredAttributesPerRule
      Maximum number of preferred attributes per rule.
    • numClasses

      protected int numClasses
      Auxiliary files indicating number classes (classification problems only).
    • rules

      protected Map<Integer,List<Rule>> rules
      Maps a class identifier to a list of initial rules (for regression problems, 0 is used as a class id).
    • preferredConditions

      protected Map<Integer,MultiSet<CompoundCondition>> preferredConditions
      Maps a class identifier to a list of preferred conditions (for regression problems, 0 is used as a class id).
    • preferredAttributes

      protected Map<Integer,MultiSet<String>> preferredAttributes
      Maps a class identifier to a list of preferred attributes (for regression problems, 0 is used as a class id).
    • forbiddenConditions

      protected Map<Integer,List<CompoundCondition>> forbiddenConditions
      Maps a class identifier to a list of forbidden conditions (for regression problems, 0 is used as a class id).
    • forbiddenAttributes

      protected Map<Integer,List<String>> forbiddenAttributes
      Maps a class identifier to a list of forbidden attributes (for regression problems, 0 is used as a class id).
  • Constructor Details

    • Knowledge

      public Knowledge(IExampleSet dataset, MultiSet<Rule> rules, MultiSet<Rule> preferredConditions, MultiSet<Rule> forbiddenConditions)
      Initializes knowledge from collections of initial rules, preferred/forbidden conditions and attributes.
      Parameters:
      dataset -
      rules - Collection of initial rules.
      preferredConditions - Collection of preferred conditions (it also contains preferred attributes).
      forbiddenConditions - Collection of forbidden conditions (it also contains forbidden attributes).
  • Method Details

    • getRules

      public List<Rule> getRules(int classId)
      Gets element of rules for a given class identifier.
    • getPreferredConditions

      public MultiSet<CompoundCondition> getPreferredConditions(int classId)
      Gets element of preferredConditions for a given class identifier.
    • getPreferredAttributes

      public MultiSet<String> getPreferredAttributes(int classId)
      Gets element of preferredAttributes for a given class identifier.
    • getForbiddenConditions

      public List<CompoundCondition> getForbiddenConditions(int classId)
      Gets element of forbiddenConditions for a given class identifier.
    • getForbiddenAttributes

      public List<String> getForbiddenAttributes(int classId)
      Gets element of forbiddenAttributes for a given class identifier.
    • getRules

      public List<Rule> getRules()
      Gets element of rules for 0th (default) class identifier.
    • getPreferredConditions

      public MultiSet<CompoundCondition> getPreferredConditions()
      Gets element of preferredConditions for 0th (default) class identifier.
    • getPreferredAttributes

      public MultiSet<String> getPreferredAttributes()
      Gets element of preferredAttributes for 0th (default) class identifier.
    • getForbiddenConditions

      public List<CompoundCondition> getForbiddenConditions()
      Gets element of forbiddenConditions for 0th (default) class identifier.
    • getForbiddenAttributes

      public List<String> getForbiddenAttributes()
      Gets element of forbiddenAttributes for 0th (default) class identifier.
    • isExtendUsingPreferred

      public boolean isExtendUsingPreferred()
    • setExtendUsingPreferred

      public void setExtendUsingPreferred(boolean extendUsingPreferred)
    • isExtendUsingAutomatic

      public boolean isExtendUsingAutomatic()
    • setExtendUsingAutomatic

      public void setExtendUsingAutomatic(boolean extendUsingAutomatic)
    • isInduceUsingPreferred

      public boolean isInduceUsingPreferred()
    • setInduceUsingPreferred

      public void setInduceUsingPreferred(boolean induceUsingPreferred)
    • isInduceUsingAutomatic

      public boolean isInduceUsingAutomatic()
    • setInduceUsingAutomatic

      public void setInduceUsingAutomatic(boolean induceUsingAutomatic)
    • isConsiderOtherClasses

      public boolean isConsiderOtherClasses()
    • setConsiderOtherClasses

      public void setConsiderOtherClasses(boolean considerOtherClasses)
    • getPreferredConditionsPerRule

      public int getPreferredConditionsPerRule()
    • setPreferredConditionsPerRule

      public void setPreferredConditionsPerRule(int v)
      Sets preferredConditionsPerRule. The value of 0 is translated to the infinity.
    • getPreferredAttributesPerRule

      public int getPreferredAttributesPerRule()
    • setPreferredAttributesPerRule

      public void setPreferredAttributesPerRule(int v)
      Sets preferredAttributesPerRule. The value of 0 is translated to the infinity.
    • isForbidden

      public boolean isForbidden(String attribute, IValueSet set)
      Checks if given condition is forbidden by the knowledge (0 is used as a class id).
      Parameters:
      attribute - Attribute upon the condition is built.
      set - Value set in the condition.
      Returns:
      Test result.
    • isForbidden

      public boolean isForbidden(String attribute, IValueSet set, int classId)
      Checks if given condition is forbidden by the knowledge for specified class.
      Parameters:
      attribute - Attribute upon the condition is built.
      set - Value set in the condition.
      classId - Class identifier
      Returns:
      Test result.
    • toString

      public String toString()
      Generates text representation of user's knowledge.
      Overrides:
      toString in class Object
      Returns:
      Text representation of knowledge.