In this toy example, it's obvious how the reconciler transforms
data where the keys overlap. For the keys that do not overlap -
3 and 4 in this example - they are copied unaltered.
A practical use for mergeByKey has been in smoothing keypoints
from a TensorFlow pose. In this case, we want to smooth new keypoints
with older keypoints. But if a keypoint is not present, for it to be
passed through.
Merges arrays left to right, using the provided
reconcile
function to choose a winner when keys overlap.There's also Data.Maps.mergeByKey if the input data is in Map form.
For example, if we have the array A: [
A-1
,A-2
,A-3
]And array B: [
B-1
,B-2
,B-4
]And with the key function:
If they are merged with the reconile function:
The final result will be:
[
B!1
,B!2
,A-3
,B-4
]In this toy example, it's obvious how the reconciler transforms data where the keys overlap. For the keys that do not overlap - 3 and 4 in this example - they are copied unaltered.
A practical use for
mergeByKey
has been in smoothing keypoints from a TensorFlow pose. In this case, we want to smooth new keypoints with older keypoints. But if a keypoint is not present, for it to be passed through.