mXparser based Weka filter and classifier

A few weeks ago, I came across the mXparser library, which allows you not only to parse and evaluate mathematical expressions, but also to define your own functions.

Today, I had a bit of time and I quickly put together a Weka package consisting of a filter and a classifier:

The filter uses the mathematical expression to update a specified target attribute, the classifier to make a prediction. In the expression, you can access the attribute values through a generic name (‘attX’ with X being the 1-based attribute index) or through the attribute name (stripped off all non-alphanumeric characters and lower case).

Since the first release (2018.2.19) was put together rather quickly, it only accepts numeric attributes as input data at this stage.

Here are some highlights of the mXparser library:

  • basic operators, i.e.: +, -, *, ^, !
  • Boolean logic operators i.e.: or, and, xor
  • binary relations i.e.: =, <, >
  • math functions (large library of 1-arg, 2-arg, 3-arg – – functions) i.e.: sin, cos, Stirling numbers, log, inverse functions
  • constants (large library), i.e.: pi, e, golden ratio
  • n-args functions i.e.: greatest common divisor
  • iterated summation and product operators
  • differentiation and integration