HeaRTDroid

HeaRTDroid is a rule-based inference engine both for Android mobile devices, and desktop solutions

User Tools

Site Tools


pub:software:heartdroid:documentation:hmr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
pub:software:heartdroid:documentation:hmr [2017/01/19 09:21]
msl [Primitives]
pub:software:heartdroid:documentation:hmr [2017/05/15 07:39]
admin [Rules]
Line 8: Line 8:
  
 This section will present the semi-formal definition of HMR along with link to the full grammar used in actual parser generation process (using [[http://​mousepeg.sourceforge.net/​|Mouse parser generator]]). Firstly, there will be defined primitive types used in HMR. Subsequent subsections will concern more and more complex elements of a HMR model. This section will present the semi-formal definition of HMR along with link to the full grammar used in actual parser generation process (using [[http://​mousepeg.sourceforge.net/​|Mouse parser generator]]). Firstly, there will be defined primitive types used in HMR. Subsequent subsections will concern more and more complex elements of a HMR model.
 +
 +As for the notation, double-quotes ''"''​ are put around the literals, brackets ''​(''​ and ''​)''​ are used to group tokens, and question sign ''?''​ is used in some places to mark that the preceding token is optional.
  
 ==== Primitives ===== ==== Primitives =====
Line 152: Line 154:
   * //​RuleName//​ --- **mandatory** --- a field composed from owning Schema'​s name and string identifying this particular rule.   * //​RuleName//​ --- **mandatory** --- a field composed from owning Schema'​s name and string identifying this particular rule.
   * //​Conditions//​ --- **mandatory** --- list of conditions; every condition can only used Attributes declared in Schema'​s conditional part. Every condition has a form:   * //​Conditions//​ --- **mandatory** --- list of conditions; every condition can only used Attributes declared in Schema'​s conditional part. Every condition has a form:
-    <code c | Condition grammar rules>​Condition = AttributeName ​ALSV_OPERATOR Value;</​code> ​  +    <code c | Condition grammar rules>​Condition = AttributeExpression ​ALSV_OPERATOR Value TemporalParameter?​</​code> ​   
 +    * AttributeExpression may be on of following:​ 
 +<code c | Rule grammar rules> 
 +AttributeExpression = AttributeName  
 +AttributeExpression = "​valat"​ "​("​ AttributeName ","​ TimeIndex "​)"​ 
 +AttributeExpression = StatisticalOperator "​("​ AttributeName ","​ TimePeriod "​)"​ 
 +</​code>​ 
 + 
 +In the first case we use the attribute'​s name to check it's current value. In the second case we use "​valat"​ operator to get historical value of the attribute at the specified moment of time. In the last case we use a statistical operator to get a statistical characteristics of the attribute. All availavle statistical operators are described below. 
 + 
 +^ Statistical Operator ^ Type of attribute ^ Description ^ 
 +| max | numerical | returns the biggest attribute'​s value from the period | 
 +| min | numerical | returns the smallest attribute'​s value from the period | 
 +| mean | numerical | returns the average attribute'​s value from the period | 
 +| mode | both types | returns the most common atrribute'​s value from the period | 
 +| med | numerical | returns the median of the attribute'​s values from the period | 
 +| stddev | numerical | returns the standard deviation of the attribute'​s values from the period | 
 +| trend | numerical | Returns slope of the trend line fitted to attribute'​s values using the least--squares fit | 
 +| var | both types | In case of numeric attribute, returns variance of the attribute'​s ​ values from specified period of time. In case of symbolic type, variance is replaced with entropy. | 
 + 
     * ALSV_OPERATOR is one of the unary operators. Following table contains every allowed combination. "​any"​ and "​null"​ are considered as special values allowed only in "​neq"​ and "​eq"​ contexts.     * ALSV_OPERATOR is one of the unary operators. Following table contains every allowed combination. "​any"​ and "​null"​ are considered as special values allowed only in "​neq"​ and "​eq"​ contexts.
  
Line 173: Line 195:
 | gte      | Ordered | is Attribute'​s value greater or equal Value? |  | gte      | Ordered | is Attribute'​s value greater or equal Value? | 
  
 +    * Additionally,​ in recent versions there were introduced optional Temporal Parameters, which check if a specified condition was satisfied in a period of time. 
 +<code c | Condition grammar rules>
 +TemporalParameter = "​{"​ "​min"/"​exact"/"​max"​ Number "​%"​ "​in"​ TimePeriod "​}"​
 +</​code>​
  
   * //​Decisions//​ - contains a list of Decisions, that have to fired when the all conditions are satisfied. Each Decisions has to assign value to Attribute already listed in owning Schema. It can be expressed as:   * //​Decisions//​ - contains a list of Decisions, that have to fired when the all conditions are satisfied. Each Decisions has to assign value to Attribute already listed in owning Schema. It can be expressed as:
Line 178: Line 204:
     * //​DecisionalExpression//​ has a form of algebraic expression using a set of left-associative binary operators and unary operators. There exist three types of allowed operands:     * //​DecisionalExpression//​ has a form of algebraic expression using a set of left-associative binary operators and unary operators. There exist three types of allowed operands:
       - Value (Symbol, Number, List, "​null"​)       - Value (Symbol, Number, List, "​null"​)
-      - Attribute'​s name (evaluates to Attribute'​s value)+      - AttributeExpression
         * :!: Symbols and Attribute names share the same namespace; name clash is solved in favour of Attribute ​         * :!: Symbols and Attribute names share the same namespace; name clash is solved in favour of Attribute ​
       - another Expression with higher precedence (can be obtained using brackets as in common algebra).       - another Expression with higher precedence (can be obtained using brackets as in common algebra).
Line 196: Line 222:
 | Plans | Statistical features of Attribute'​s history | | Plans | Statistical features of Attribute'​s history |
  
 +Also, all the 
  
       * binary operators with functional notation can be found in next table        * binary operators with functional notation can be found in next table 
Line 223: Line 250:
 </​code>​ </​code>​
  
-  * //Certainty Factor// is an optional number from range ''<​0,​ 1.0>''​. If present, has to be preceded with ''#''​ symbol. This number is used to handle uncertain knowledge in the reasoning phase.+  * //Certainty Factor// is an optional number from range ''<​-1.0, 1.0>''​. If present, has to be preceded with ''#''​ symbol. This number is used to handle uncertain knowledge in the reasoning phase.
  
   * Example of rule:   * Example of rule:
pub/software/heartdroid/documentation/hmr.txt · Last modified: 2019/04/10 06:54 (external edit)