{"title":"Rule Engine (Dictionary)","nodeType":"Predictor","id":"*GpUdH91fJl4_KfiB","factoryName":"org.knime.base.node.rules.engine.twoports.RuleEngine2PortsNodeFactory","factoryId":"org.knime.base.node.rules.engine.twoports.RuleEngine2PortsNodeFactory","path":["Manipulation","Row","Other"],"owner":"knime","ownerAccountId":"account:team:b5f0848f-496d-4e6a-b869-fa3532248db7","description":"<p>Applies rules from a rules table to a data table. The rules follow the <b>Rule Engine</b> rules, though for <a href=\"http://www.dmg.org/v4-2-1/RuleSet.html\" rel=\"ugc nofollow noopener noreferrer\">PMML RuleSets</a> stricter rules apply (no column reference in the outcome, cannot use regular expressions, 3-valued logic). If no rules match, the default value specified in the PMML tab is used, or missing when no default value was specified.\n <br />\n It takes a list of user-defined rules from the second input port (from the selected column(s)) and tries to match them to each row in the input table. If a rule matches, its outcome value is added into a new column. The first matching rule in order of definition determines the outcome.</p><p>Each rule is represented by a row, new line characters are replaced by spaces, even in string constants. To add comments, start a line in a (condition) cell with <tt>//</tt> (comments can not be placed in the same line as a rule). Anything after <tt>//</tt> will not be interpreted as a rule. Rules consist of a condition part (antecedent), which must evaluate to <i>true</i> or <i>false</i> , and an outcome (consequent, after the <tt>&#61;&gt;</tt> symbol) which is put into the new column if the rule matches.</p>\n                        \n            <p>The outcome of a rule may be any of the following: a string (between quotes <tt>&#34;</tt> or <tt>/</tt> ), a number, a boolean constant, a reference to another column or the value of a flow variable value. The type of the outcome column is the common super type of all possible outcomes (including the rules that can never match). If no rule matches, the outcome is a missing value unless a default value is specified.</p>\n                        \n            <p>Columns are given by their name surrounded by $, numbers are given in the usual decimal representation. Note that strings must not contain (double-) quotes. Flow variables are represented by <b>$${<!-- --></b> TypeCharacterAndFlowVarName <b>}$$</b> . (Column references are not supported for PMML outputs.) The TypeCharacter should be &#39;D&#39; for double (real) values, &#39;I&#39; for integer values and &#39;S&#39; for strings.</p>\n                        \n            <p>The logical expressions can be grouped with parentheses. The precedence rules for them are the following: <tt>NOT</tt> binds most, <tt>AND</tt> , <tt>XOR</tt> and finally <tt>OR</tt> the least. Comparison operators always take precedence over logical connectives. All operators (and their names) are case-sensitive.</p>\n                        \n            <p>The <tt>ROWID</tt> represents the row key string, the <tt>ROWINDEX</tt> is the index of the row (first row has <tt>0</tt> value), while <tt>ROWCOUNT</tt> stands for the number of rows in the table. (These are not available for PMML.)</p>\n                        \n            <p>Some example rules (each should be in one row):</p>\n                        \n            <pre>// This is a comment\n$Col0$ &gt; 0 &#61;&gt; &#34;Positive&#34;\n</pre>\n                        When the values in Col0 are greater than 0, we assign Positive to the result column value (if no             previous rule matched).\n            \n            <pre>$Col0$ &#61; &#34;Active&#34; AND $Col1$ &lt;&#61; 5 &#61;&gt; &#34;Outlier&#34;\n</pre>\n                        You can combine conditions.\n            \n            <pre>$Col0$ LIKE &#34;Market Street*&#34; AND\n    ($Col1$ IN (&#34;married&#34;, &#34;divorced&#34;)\n        OR $Col2$ &gt; 40) &#61;&gt; &#34;Strange&#34;\n$Col0$ MATCHES $${SFlowVar0}$$ OR $$ROWINDEX$$ &lt; $${IFlowVar1}$$ &#61;&gt;\n    $Col0$\n</pre>\n                        With parentheses you can combine multiple conditions. The result in the second case comes from one             of the columns.\n            \n            <pre>$Col0$ &gt; 5 &#61;&gt; $${SCol1}$$\n</pre>\n                        The result can also come from a flow variable.\n            \n            <p>The following comparisons result true (other values are neither less, nor greater or equal to missing and NaN values):</p><ul><li><b>?</b> &#61;,&lt;&#61;,&gt;&#61; <b>?</b></li><li><b>NaN</b> &#61;,&lt;&#61;,&gt;&#61; <b>NaN</b></li></ul>\n                            \n            \n            \n        \n        ","shortDescription":"Applies the rules from the second input port to the first datatable.","keywords":[],"deprecated":false,"streamable":true,"tags":["Manipulation","Row","Other","Streamable"],"icon":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3hpVFh0WE1MOmNvbS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WViYS00MGU3LTkxODktYmJlOGQ3ZDBmMjRlIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+JvYtSAAAAOxJREFUeNqkU0kOgzAMdBANvAkhFQ4cuSKeAG/gwHP4IlmIm0Q1VaCl0I4UKTH2eBLGDBGBMYY3nsARbBpoJejIXL4UM8QUcYcj2CYBn5LCB6KgxTVgQGCMgV/wN0F8Wu/mijxJQwXfkGUZ9H0PYp6PFVAnenWlFHDO/f5eFJCk6dsCNMuCUkrcYhxHl4BVVQVx6wP0tURAcPumaYJit6Zp8jGt1DFBXddrEa1hGNbv6qlyR7BovSa1bbsW53keSP9IQNIIXddhWZa7N6FGRMBomPCslV2e/UPOB3Z+WHTZeuFQvXxAzrqKhwADALmDG8FwJcY0AAAAAElFTkSuQmCC","views":[],"inPorts":[{"objectClass":"org.knime.core.node.BufferedDataTable","color":"000000","dataType":"Table","optional":false,"name":"Data","description":"Input data"},{"objectClass":"org.knime.core.node.BufferedDataTable","color":"000000","dataType":"Table","optional":false,"name":"Rules","description":"Rules to apply"}],"outPorts":[{"objectClass":"org.knime.core.node.BufferedDataTable","color":"000000","dataType":"Table","optional":false,"name":"Rules applied","description":"Table containing the computed column"},{"objectClass":"org.knime.core.node.port.pmml.PMMLPortObject","color":"1469af","dataType":"PMML","optional":false,"name":"PMML ruleset","description":"Possibly missing PMML port containing the rules in PMML RuleSet format"}],"dynInPorts":[],"dynOutPorts":[],"additionalSiteInformation":{"url":"https://update.knime.com/analytics-platform/5.12","trusted":true,"enabledByDefault":true,"name":"KNIME Analytics Platform 5.12 Update Site","version":"5.12.0"},"dialog":[{"sectionName":"Options","fields":[{"name":"Dictionary mode","description":"Choose how the rules table encodes the rules.\n<ul><li><b>Rule</b> : A single column contains the full rule expression including the outcome (e.g. &#34;$Col$ &gt; 0 &#61;&gt; TRUE&#34;).</li><li><b>Condition and value</b> : Two separate columns are used: one for the condition part of the rule and one for the outcome value.</li></ul>","optional":false},{"name":"Rule column","description":"The column in the rules table that contains the full rule expressions (condition and outcome combined, e.g. &#34;$Col$ &gt; 0 &#61;&gt; TRUE&#34;).","optional":false},{"name":"Condition column","description":"The column in the rules table that contains the condition part of each rule (e.g. &#34;$Col$ &gt; 0&#34;).","optional":false},{"name":"Value column","description":"The column in the rules table that contains the outcome value for each rule (e.g. &#34;TRUE&#34; or &#34;FALSE&#34;).","optional":false},{"name":"Treat values starting with $ as references","description":"When checked, values in the value column that start with $ will be treated as references (for example, column, flow variable, or table property references) rather than literal string values.","optional":false},{"name":"Output mode","description":"Choose whether to append a new column with the outcome of the rules, or replace an existing column.\n<ul><li><b>Append column</b> : Append a new column with the rule outcome to the input table.</li><li><b>Replace column</b> : Replace an existing column in the input table with the rule outcome.</li></ul>","optional":false},{"name":"Append column","description":"Name of the newly appended column, which contains the outcome of the rules.","optional":false},{"name":"Replace column","description":"The column to replace with the rule outcome.","optional":false},{"name":"Enable PMML RuleSet generation","description":"When checked, PMML mode evaluation is used and fails if the input cannot be translated to PMML.","optional":false},{"name":"Hit selection","description":"The method used to select the outcome when multiple rules match.\n<ul><li><b>First hit</b> : The outcome of the first matching rule will be used.</li><li><b>Maximal matching weighted sum</b> : Select all matching rules, sum the weight for all outcomes, select the highest sum&#39;s outcome.</li><li><b>Highest matching weight</b> : Select from all matching rules the highest weight (regardless of order) and use its outcome.</li></ul>","optional":false},{"name":"Default value/score","description":"The default score/value to use when no rules matched.","optional":false},{"name":"Default rule confidence","description":"The default confidence value to use when it is not specified by the confidence column.","optional":false},{"name":"Rule confidence column","description":"Specifies confidence of the rules based on the values in the selected column.","optional":false},{"name":"Default rule weight","description":"The default weight value to use when it is not specified by the weight column.","optional":false},{"name":"Rule weight column","description":"Specifies weight values for the rules based on the values in the selected column.","optional":false},{"name":"Append confidence values","description":"When checked, confidence values are computed and written into a new column in the output table.","optional":false},{"name":"Confidence column name","description":"The name of the column to write confidence values into.","optional":false},{"name":"Provide statistics","description":"When checked, <tt>recordCount</tt> (and if <b>Validation column</b> is selected, also <tt>nbCorrect</tt> ) is computed for the PMML output.","optional":false},{"name":"Validation column","description":"The column which contains the correct prediction for the input (test/validation) table. When <b>&lt;none&gt;</b> selected, no <tt>nbCorrect</tt> value will be computed.","optional":false}]}],"links":[],"kudos":[{"accountId":"account:user:552210dd-3dfc-4b47-bbe6-477d972e6b9e","user":"nilotpalc","date":"2022-11-03T12:48:34+00:00"}],"kudosCount":1,"bundleInformation":{"bundleVersion":"5.12.0.v202606171353","bundleName":"KNIME Java Snippet Nodes","bundleSymbolicName":"org.knime.jsnippets","bundleVendor":"KNIME AG, Zurich, Switzerland","featureSymbolicName":"org.knime.features.javasnippet","featureName":"KNIME Javasnippet","featureVersion":"5.12.0.v202606171353","featureVendor":"KNIME AG, Zurich, Switzerland","extensionId":"*hXfYFyb7ZzM0xseG"},"frequentSuccessors":[{"id":"*zpGPAjDyExkFL2HB","factoryName":"org.knime.base.node.rules.engine.RuleEngineNodeFactory","probability":0.12244897959183673},{"id":"*eOn8ibZnxIkY7XhT","factoryName":"org.knime.base.node.preproc.stringmanipulation.StringManipulationNodeFactory","probability":0.06802721088435375},{"id":"*ZgYyOm1P9VJVBE9e","factoryName":"org.knime.base.node.preproc.joiner.Joiner2NodeFactory","probability":0.047619047619047616},{"id":"*jd2U-FYTI8jCbQls","factoryName":"org.knime.base.node.preproc.filter.row.RowFilterNodeFactory","probability":0.04081632653061224},{"id":"*GpUdH91fJl4_KfiB","factoryName":"org.knime.base.node.rules.engine.twoports.RuleEngine2PortsNodeFactory","probability":0.04081632653061224},{"id":"*5stmXk6zY_ORA4bC","factoryName":"org.knime.base.node.preproc.groupby.GroupByNodeFactory","probability":0.034013605442176874},{"id":"*uVmaGQkzUOFCTqUe","factoryName":"org.knime.base.node.preproc.pmml.missingval.compute.MissingValueHandlerNodeFactory","probability":0.034013605442176874},{"id":"*CCMhDNWHYFXV506q","factoryName":"org.knime.base.node.meta.looper.LoopEndJoin2NodeFactory","probability":0.034013605442176874},{"id":"*DOkyMaii62U05xZ1","factoryName":"org.knime.base.node.preproc.filter.column.DataColumnSpecFilterNodeFactory","probability":0.034013605442176874},{"id":"*kUvKnVY5f2t5i5n1","factoryName":"org.knime.base.node.flowvariable.variableloophead.LoopStartVariableNodeFactory","probability":0.027210884353741496}]}
