 <p>From javadoc of <a href="http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/MathExpression.html" rel="nofollow">MathExpression</a></p> <blockquote> <p>The 'A' letter refers to the value of the attribute being processed. Other attribute values (numeric only) can be accessed through the variables A1, A2, A3, ...</p> </blockquote> <p>Your filter applies to all attributes of your dataset. If I load iris dataset and apply following filter.</p> <blockquote> <p>weka.filters.unsupervised.attribute.MathExpression -E log(A).</p> </blockquote> <p>your attribute ,sepallength values change as following.</p> <pre><code>Before Filter After Filter Minimum 4.3 Minimum 1.459 Maximum 7.9 Maximum 2.067 Mean 5.843 Mean 1.755 StdDev 0.828 StdDev 0.141 </code></pre> <p>Also if you look to javadoc, there is no if else function but ifelse function. Therefore you should write something like</p> <pre><code>ifelse ( (A == 2 || A == 0), 1,0 ) </code></pre> <p>Also this filter applies to all attributes. If you want to change only one attribute and according to other attribute values ; then you need to use "Ignore range option" and use A1,A2 to refer to other attribute values.</p> <p>if you need to add new attribute use <a href="http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/AddExpression.html" rel="nofollow">AddExpression</a>.</p> <blockquote> <p>An instance filter that creates a new attribute by applying a mathematical expression to existing attributes. </p> </blockquote>