I am trying to build a machine learning model which predicts a single number from a series of numbers. I am using a Sequential model from the keras API of Tensorflow.
You can imagine my dataset to look something like this:
| Index | x data | y data | 
|---|---|---|
| 0 | np.ndarray(shape (1000000,) ) | numpy.float32 | 
| 1 | np.ndarray(shape (1000000,) ) | numpy.float32 | 
| 2 | np.ndarray(shape (1000000,) ) | numpy.float32 | 
| 3 | np.ndarray(shape (1000000,) ) | numpy.float32 | 
| ... | ... | ... | 
This was my first attempt:
I tried using a numpy ndarray which contains numpy ndarrays which finally contain floats as my xdata, so something like this:
array([
    array([3.59280851, 3.60459062, 3.60459062, ..., 4.02911493]) #the inner arrays have 1000000 elements each
    array([3.54752101, 3.56740332, 3.56740332, ..., 4.02837855])
    array([3.61048168, 3.62152741, 3.62152741, ..., 4.02764217])
    ...
])
My y data is a numpy ndarray containing floats, which looks something like this
array([2.9864411, 3.0562437, ... , 2.7750807, 2.8712902], dtype=float32)
But when I tried to train the model using model.fit() it yields this error:
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray).
You can have a closer look at my current try with this minimal example on Google Colab here.
Question: Easily said I just want my model to predict a number from a sequence of numbers. For example like this:
- array([3.59280851, 3.60459062, 3.60459062, ...]) => 2.8989773
- array([3.54752101, 3.56740332, 3.56740332, ...]) => 3.0893357
- ...
How can I use a sequence of numbers to predict a single number in Tensorflow?
All in all I think that my question ist pretty general and should be easy to answer if you know how to tackle this problem, unlike me. Thanks in advance!
