I am trying to build a machine learning model which predicts a single number from a sequence of numbers.

Please fell free to have a look at this minimal example in Google Colab to understand what I am talking about.

You can imagine my dataset to look something like this:

Index | x data | y data |
---|---|---|

0 | `np.ndarray(shape (1209278,) )` |
`numpy.float32` |

1 | `np.ndarray(shape (1211140,) )` |
`numpy.float32` |

2 | `np.ndarray(shape (1418411,) )` |
`numpy.float32` |

3 | `np.ndarray(shape (1077132,) )` |
`numpy.float32` |

… | … | … |

In a nutshell, my goal is the following: **Predicting a single number from a sequence of numbers.**

For example:

- np.array([3.461, 3.478, 3.478, 3.485, 3.489, 3.489, 3.492]) => 3.281
- np.array([3.469, 3.481, 3.481, 3.495, 3.495]) => 3.271
- …

Additionally it is important to understand, that the lengths of my input sequences may vary and are **not** of the same shape.

I was able to train my model (as you can see in the minimal example) but apparently the desired output is nothing at all like the one I expected it to be. Right now I’m stuck with this problem. I was expecting it to be working just fine, because I saw the loss decreasing.

Apparently this is not the case. I would be very thankful if you could find the time to have a look at the minimal example I provided.

Thanks in advance!