Constructing tfdatasets from (nested) tibbles

Hi everyone :slight_smile:

recently I started a project in R where I want to use a neural network on nested tibbles, but to be honest the last time I made a neural network was over 5 years ago, so I forgot a lot of the details.
At the moment I'm facing two problem within this project:

  1. The first is more detailed, as of how my data is structured and how to get this data in a neural network. I started an in depth explanation of the data and the problem here (where you also can find a MWE) and then realized that I do also have a more general problem, that does not fit in the stackoverflow world, so I came here.
  2. The second is my general understanding of the tfdataset API in connection with nested tibbles and how to construct a dataset from those. This is the main topic for this post:

In this Tutorial (https:// tensorflow.rstudio .com /guide/tfdatasets/feature_spec/) a feature_spec is created from a tibble, which is a good starting point for me. But I was looking for a way to see the actual data that is fed into the network itself. Then I found this Tutorial (https: // tensorflow.rstudio .com /tutorials/beginners/load/load_csv/), which shows how to generate a dataset from csv.-files. This is the interesting part for me:

layer <- layer_dense_features(feature_columns = dense_features(spec))
train_dataset %>% 
  reticulate::as_iterator() %>% 
  reticulate::iter_next() %>% 
  layer()

where you can actually see the Tensor from the PrefetchDataset after the transformation via the feature_spec.


Now I'd love to combine these two Tutorials into one:
Either to create a PrefetchDataset from my data and thus also solve question 1., since I can just insert the PrefetchDataset into the network.
Or to find a way to print the content of my data without using the PrefetchDataset and solving problem 1 in a different manner.

The idea that there is no way to generate a PrefetchDataset from a tibble (IMHO. the most common data structure in R) feel so strange to me that I rather believe I missed something in the documentation.

Do you have any idea how to accomplish one of these tasks or maybe some documentation about how to deal with nested tibbles in R and keras?

Thank you.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.