LoginSignup
1
2

More than 5 years have passed since last update.

tensorflow-lstm-regression > test / train / validationの分割割合

Last updated at Posted at 2016-11-03

LSTMでのsine curveの学習。
http://qiita.com/7of9/items/11500a5c26d4c8828062#x%E3%81%AE%E5%80%A4

上記において、以下の3つのデータを用意している。

  • train (8097)
  • test (997)
  • validation (897)

10,000のデータセットに対してこの割合をどこで定義しているのか。

データの準備は以下のgenerate_data()を使っている。

def generate_data(fct, x, time_steps, seperate=False):
    """generates data with based on a function fct"""
    data = fct(x)
    if not isinstance(data, pd.DataFrame):
        data = pd.DataFrame(data)
    train_x, val_x, test_x = prepare_data(data['a'] if seperate else data, time_steps)
    train_y, val_y, test_y = prepare_data(data['b'] if seperate else data, time_steps, labels=True)
    return dict(train=train_x, val=val_x, test=test_x), dict(train=train_y, val=val_y, test=test_y)

上記ではprepare_data() を使っている。

def prepare_data(data, time_steps, labels=False, val_size=0.1, test_size=0.1):

デフォルト引数で10%, 10%, 80%の割合となっている。

正確な割合ではない(3つの合計9991に対しては、9.97%, 8.99%, 81.04%)なのは未消化。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2