0
votes

I have an attribute that I added using AddExpression filter, and now I want to change its values so that all negative values are set to zero. I tried using MathExpression filter like this:

MathExpression -E "ifelse(A > 0, A, 0)" -V -R 17

17 is the attribute index seen in weka Preprocess/Attributes. But after applying it, I can still see that minimum value for my attribute is -5, not 0 as expected. What am I doing wrong?

If it changes anything, I removed some attributes before applying this filter, so the attribute index changed

1

1 Answers

0
votes

The problem appears to be some kind of bug - it sometimes works but sometimes it doesn't. I don't know the exact way to reproduce it. However, I've found a workaround, that works if there aren't many negative values.

If you click on the Edit button, you can sort rows by the attribute you want to modify, and manually change negative values to zeros. If you want to preserve the original row order, before sorting add an ID attribute using AddID filter. After you're finished modyfing values, sort data by ID to restore the original order.