TensorFlow-Book icon indicating copy to clipboard operation
TensorFlow-Book copied to clipboard

Quick comment on Chapter 10

Open airman604 opened this issue 9 years ago • 1 comments

In Concept01_timeseries_data.ipynb in Chapter 10, I believe you can simplify and speed up the following code:

def split_data(data, percent_train=0.80):
    num_rows = len(data)
    train_data, test_data = [], []
    for idx, row in enumerate(data):
        if idx < num_rows * percent_train:
            train_data.append(row)
        else:
            test_data.append(row)
    return train_data, test_data

as follows:

def split_data(data, percent_train=0.80):
    num_rows = len(data)*percent_train
    return data[:num_rows], data[num_rows:]

airman604 avatar Jan 24 '17 21:01 airman604

I didn't want to open an issue for this and it is related to Chapter 10. Can you please add an example that uses batch_sequences_with_states method?

kureta avatar Mar 17 '17 09:03 kureta