Preparing for training and testing

Now we'll split our features into train and test subsets. We won't be randomizing our data because, in time series for financial markets, the data comes every day in a regular manner and we have to follow it like it is. You can't predict the past behavior if you train for the future data because that would be useless. We are always interested in the future behavior of the stock market:

features = features_and_labels[features_and_labels.columns[2:]] 
labels = features_and_labels[features_and_labels.columns[:2]] 
train_size = int(len(features_and_labels) * train_test_split) 
test_size = len(features_and_labels) - train_size 
train_features = features[:train_size] 
train_labels = labels[:train_size] 
test_features = features[train_size:] 
test_labels = labels[train_size:]
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.15.100