{"action":"created","issue":{"url":"https://api.github.com/repos/hunkim/DeepLearningZeroToAll/issues/187","repository_url":"https://api.github.com/repos/hunkim/DeepLearningZeroToAll","labels_url":"https://api.github.com/repos/hunkim/DeepLearningZeroToAll/issues/187/labels{/name}","comments_url":"https://api.github.com/repos/hunkim/DeepLearningZeroToAll/issues/187/comments","events_url":"https://api.github.com/repos/hunkim/DeepLearningZeroToAll/issues/187/events","html_url":"https://github.com/hunkim/DeepLearningZeroToAll/issues/187","id":246004203,"number":187,"title":"Issue on minmax scaling with whole data","user":{"login":"prinsommer","id":27483315,"avatar_url":"https://avatars1.githubusercontent.com/u/27483315?v=4","gravatar_id":"","url":"https://api.github.com/users/prinsommer","html_url":"https://github.com/prinsommer","followers_url":"https://api.github.com/users/prinsommer/followers","following_url":"https://api.github.com/users/prinsommer/following{/other_user}","gists_url":"https://api.github.com/users/prinsommer/gists{/gist_id}","starred_url":"https://api.github.com/users/prinsommer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prinsommer/subscriptions","organizations_url":"https://api.github.com/users/prinsommer/orgs","repos_url":"https://api.github.com/users/prinsommer/repos","events_url":"https://api.github.com/users/prinsommer/events{/privacy}","received_events_url":"https://api.github.com/users/prinsommer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-07-27T11:03:01Z","updated_at":"2017-07-29T02:14:35Z","closed_at":null,"body":"In <lab-12-5-rnn_stock_prediction.py>, minmax scaling is carried out by using whole data.\r\nHowever, it is assumed that we can only see the training data, and the test data is hidden.\r\nSo, I think we should correct the first part of the code as follows:\r\n\r\n-------------------------------------------------------------------------------------------------------\r\n\r\n```python\r\nxy = np.loadtxt('data-02-stock_daily.csv', delimiter=',')\r\nxy = xy[::-1]\r\ntrain_size = int(len(xy) * 0.7)\r\ntrain = np.array(xy[0:train_size])\r\ntest = np.array(xy[train_size:len(data)])\r\n\r\ndef MinMaxScaler(data):\r\n    numerator = data - np.min(train, 0)\r\n    denominator = np.max(train, 0) - np.min(train, 0)\r\n    return numerator / (denominator + 1e-7)\r\n\r\nxy_train = MinMaxScaler(train)\r\nxy_test = MinMaxScaler(test)\r\n\r\nlist_trainX = []\r\nlist_trainY = []\r\nfor i in range(0, len(xy_train) - seq_length):\r\n    x = xy_train[i:i + seq_length]\r\n    y = xy_train[:,[-1]][i + seq_length]\r\n    list_trainX.append(x)\r\n    list_trainY.append(y)\r\n\r\nlist_testX = []\r\nlist_testY = []\r\nfor i in range(0, len(xy_test) - seq_length):\r\n    x = xy_test[i:i + seq_length]\r\n    y = xy_test[:,[-1]][i + seq_length]\r\n    list_testX.append(x)\r\n    list_testY.append(y)\r\n\r\ntrainX, testX = np.array(list_trainX), np.array(list_testX)\r\ntrainY, testY = np.array(list_trainY), np.array(list_testY)\r\n```"},"comment":{"url":"https://api.github.com/repos/hunkim/DeepLearningZeroToAll/issues/comments/318796822","html_url":"https://github.com/hunkim/DeepLearningZeroToAll/issues/187#issuecomment-318796822","issue_url":"https://api.github.com/repos/hunkim/DeepLearningZeroToAll/issues/187","id":318796822,"user":{"login":"kkweon","id":2981167,"avatar_url":"https://avatars3.githubusercontent.com/u/2981167?v=4","gravatar_id":"","url":"https://api.github.com/users/kkweon","html_url":"https://github.com/kkweon","followers_url":"https://api.github.com/users/kkweon/followers","following_url":"https://api.github.com/users/kkweon/following{/other_user}","gists_url":"https://api.github.com/users/kkweon/gists{/gist_id}","starred_url":"https://api.github.com/users/kkweon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkweon/subscriptions","organizations_url":"https://api.github.com/users/kkweon/orgs","repos_url":"https://api.github.com/users/kkweon/repos","events_url":"https://api.github.com/users/kkweon/events{/privacy}","received_events_url":"https://api.github.com/users/kkweon/received_events","type":"User","site_admin":false},"created_at":"2017-07-29T02:14:35Z","updated_at":"2017-07-29T02:14:35Z","body":"Because it is a code smell. \r\n\r\n- It is not consistent with other files.\r\n- It is not following the PEP8 either.\r\n \r\nThe discussion was done in #109. \r\nHashtag followed by a number refers to the related issue. "}}
{"actor":{"display_login":"kkweon"}}