Skip to content

temporian.to_tensorflow_dataset #

to_tensorflow_dataset(
    evset: EventSet, timestamps: str = "timestamp"
) -> tensorflow.data.Dataset

Converts an EventSet to a tensorflow Dataset.

Usage example
evset = event_set(
    timestamps=[1, 2, 3, 4],
    features={
        "f1": [10, 11, 12, 13],
        "f2": [b"a", b"b", b"c", b"d"],
        "label": [0, 1, 0, 1],
    },
)

tf_dataset = tp.to_tensorflow_dataset(evset)

def extract_label(example):
    label = example.pop("label")
    return example, label
tf_dataset = tf_dataset.map(extract_label).batch(100)

model = ... # A Keras model
model.fit(tf_dataset)

Parameters:

Name Type Description Default
evset EventSet

Input event set.

required
timestamps str

Output key containing the timestamps.

'timestamp'

Returns:

Type Description
Dataset

TensorFlow dataset created from EventSet.