ageron / ageron/handson-ml

Using the RNNs with Dataset APIs instead of Chapter 14 approach ?

Open
#286 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
25.6k
Forks
12.7k
PR merge metrics
No merged PRs in 30d

Description

Hi -

I have been puzzled by the way you handle the data the way you do in chapter 14 on RNNs.
In particular, I am looking at your example on page 392 regarding time series.

Can you please tell me why it is you do not use the Dataset API ? I have tried using the Dataset API but I fail at it, so that maybe the reason you avoid it altogether?

The data_x is the timeseries and data_y is the timeseries one unit forward in time.

```python
x_t = tf.convert_to_tensor(data_x, np.float32)
y_t = tf.convert_to_tensor(data_y, np.float32)

dataset = tf.data.Dataset.from_tensor_slices((x_t,y_t))
dataset = dataset.batch(num_batch)
```

... so the num_batch is what you use as n_steps as it defines the lenght of the timeseries window in a batch, so not quite the same as the "number of batches".

```python
dataset = dataset.shuffle(buffer_size=10000)
dataset = dataset.repeat(num_epochs)
```

So now I have the data the way I want to have it ... nicely chupped up ... but, and here is where I get stuck - It seems to be a problem feeding the data to the model.

Have you tried something in the lines above please ?

Thank you very much in advance.

Br, Jesper

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Chapter 14 RNN time-series example on page 392 and the TensorFlow Dataset API snippets in the issue. Compare the dataset pipeline with the model's expected input, then determine whether the chapter needs clarification; done means the Dataset API question is answered in the relevant material.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.