Solutions to "Just KNIME It!" Challenge 4

This is fun! ^^
My solution as well: Challenge 4 - Days With Price Changes – KNIME Hub

1 Like

Hi
here my solution: jKi-4 – KNIME Hub

Hello @BernSilva and Welcome to the KNIME community!

I noticed you mark rows with a price rise only, but we want to mark all rows with a price change.
Nice idea with the colour manager btw! :wink:

2 Likes

Oh no!! :scream:
That’s a really good point - minor change in Rule Engine and bug is fixed :yum:
Thanks for the feedback! :heart:

3 Likes

Hello

As the level of the workflows is increasingly becoming higher… I’ve updated my solution addressing some of the previous comments.

Then as @Thyme has suggested, the workflow has been connected to challenge data. And following @bruno29a 's recommendation about formatting the Date in the CSV as well. Moreover it has been added a control on data gaps, using it later to keep the data sorted ascending by Date.

And latest but not least, I also see few people plotting the prices :wink: and I wonder; Why not make it?

BR

3 Likes

No problem @msworn . Indeed, there is no way to handle the missing value in the Math Formula. I tried a few things myself, as I wanted to see it work with Math Formula, but it would seem like the moment you include the missing value, the row does not get evaluatated.

The easiest thing to test this is with this:
$$ROWINDEX$$ == 0 || $Price$ != $Price(-1)$

It returns a missing value.
$$ROWINDEX$$ == 0 on its own gives me 1, and you’d expect the above expression to work.

Similarly, $$ROWINDEX$$ == 1 || $Price$ != $Price(-1)$ works (but it’s not part of the request). The 2nd row would give me 1 in the Change column with this rule.

So, it seems like the moment there is a missing value in the condition, the Math Formula returns missing.

But it was a good idea to use the Math Formula. It’s too bad it can’t handle or “bypass” the missing value. We’d have to do additional operations with another node to handle the first row.

@ChristensenCode Thanks for the opportunity to learn about another node: Column Comparator! I used a Math Formula, which works perfectly fine, but I’ve added another arm to my solution and used the CC. Super stuff!

1 Like

Indeed @lenexa_jayhawk , the Column Comparator used by @ChristensenCode is also a great way to compare 2 columns. Nicely done @ChristensenCode

To be more accurate, the Math Formula cannot handle a missing value and fails the evaluation. The cell doesn’t get a proper value assigned and stays a null.
The reason for this is that variables in Java, even ints and doubles, are boxed in objects (Integers and Doubles). The primitive types (int, double) are not nullable, nor can they be NaN’d. They’re basically the same thing as their namesakes in C. KNIME however uses the objects, so we can have missing values (null) and NaN’s.
Now you know why the Math Formula functions isNaN(x) and isInfinite(x) don’t allow us to work around missing values: KNIME knows it’s an uninitialised value and prevents us from accessing it, because that would result in undefined behaviour (a very bad thing).

1 Like

Thanks for the detailed explanation @Thyme . It makes sense now why it cannot handle missing values.

1 Like

My Take on the Challenge -4

Here is my solution !

This time I’ve took a step further and after I created the price changes dataset in KNIME, I was able to quickly put together a chart in Tableau in order to combine the initial price and the day with the change in price, so I can highlight the positive or negative changes with the actual amount of that difference


JustKNIMEit-4

3 Likes

Hello,

here is my solution: justknimeit-4

RB

1 Like

Solution:

Hello everyone!

First of all, thank you very much for the incredible level of participation and diversity in solutions. :star_struck: :star_struck: It makes us really happy to see the knowledge about certain nodes getting spread out, and to see you all discussing different ways of tackling the challenge.

Here’s our solution: Days Whith Price Changes - Solution – KNIME Hub

Just like with many others, the Lag Column node was key in our solution.

Stay tuned for challenge 5 coming out tomorrow! :fire:

5 Likes

Hi! Here is my take :slight_smile:

Challenge 4 - Just KNIME It!

2 Likes