Skip to content

Conversation

@yongtang
Copy link
Member

@yongtang yongtang commented Aug 23, 2019

Note: This PR depends on PR #437 PR #437 has been merged.

In the past couple of months I have been trying to come up with a good example of using Prometheus with TensorFlow for infrastructure/compute usage prediction and alerting in case of anomaly. My plan was to use LSTM to combine with prometheus observation data for that.

Though there is a PrometheusDataset support already, the format of dataset is not very intuitive and hard to do it in a smooth way.

The biggest challenge is that, normally for time series data you have to setup a look back window for training, and you normalize the data (with total). Both are not easily available.

Further more, to process data in normal TF operations such as tf.roll, it requires reading the whole data into one Tenor. But this is not very straightforward as well with iterable dataset.

This PR adds tfio.IOTensor.from_prometheus which allows easily conversion the prometheus observation data into a tuple of Tensors, and do additional feature engineering.

Signed-off-by: Yong Tang [email protected]

@yongtang yongtang force-pushed the io_tensor_prometheus branch from e2c6abf to 173f5eb Compare August 23, 2019 01:03
In the past couple of months I have been trying to come
up with a good example of using Prometheus with TensorFlow
for infrastructure/compute usage prediction and alerting
in case of anomaly.

My plan was to use LSTM to combine with prometheus for that.
Though there is a PrometheusDataset support, the format
of dataset is not very intuitive and hard to do it in
a smooth way.

The biggest challenge is that, normally for time series data
you have a look back window to train, and you normalize
the data (with total). Both are not easily available.
Further more, to process data in normal TF operations
such as tf.roll, it requires reading the whole data into
one Tenor. But this is not very straightforward as well with
iterable dataset.

This PR adds tfio.IOTensor.from_prometheus which
allows easily convertion the prometheus observation
data into a tuple of Tensors, and do additional feature
engineering.

Signed-off-by: Yong Tang <[email protected]>
@yongtang yongtang force-pushed the io_tensor_prometheus branch from 173f5eb to 9ac5297 Compare August 25, 2019 03:22
@yongtang
Copy link
Member Author

@jiachengxu This PR adds prometheus support for IOTensor, though the last commit 6844b4f I added records mode for from_json that matches records in pandas's read_json. It may not cover all cases though could be a start. Please take a look.

@terrytangyuan terrytangyuan merged commit 940dd9c into tensorflow:master Aug 25, 2019
@yongtang yongtang deleted the io_tensor_prometheus branch August 25, 2019 19:25
i-ony pushed a commit to i-ony/io that referenced this pull request Feb 8, 2021
* Add tfio.IOTensor.from_prometheus support

In the past couple of months I have been trying to come
up with a good example of using Prometheus with TensorFlow
for infrastructure/compute usage prediction and alerting
in case of anomaly.

My plan was to use LSTM to combine with prometheus for that.
Though there is a PrometheusDataset support, the format
of dataset is not very intuitive and hard to do it in
a smooth way.

The biggest challenge is that, normally for time series data
you have a look back window to train, and you normalize
the data (with total). Both are not easily available.
Further more, to process data in normal TF operations
such as tf.roll, it requires reading the whole data into
one Tenor. But this is not very straightforward as well with
iterable dataset.

This PR adds tfio.IOTensor.from_prometheus which
allows easily convertion the prometheus observation
data into a tuple of Tensors, and do additional feature
engineering.

Signed-off-by: Yong Tang <[email protected]>

* Rename libtensorflow_io_prometheus.so to libtensorflow_io_golang.so

Signed-off-by: Yong Tang <[email protected]>

* Read single column at a time so that resource could be reused.

Signed-off-by: Yong Tang <[email protected]>

* Change to shapes, dtypes to match TensorSpec order

Signed-off-by: Yong Tang <[email protected]>

* Add `records` mode for `from_json` that matches `records` in pandas

Signed-off-by: Yong Tang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants