Predicting stock price with four regression algorithms

Now that we've learned four (or five, you could say) commonly used and powerful regression algorithms and performance evaluation metrics, let's utilize each of them to solve our stock price prediction problem.

We generated features based on data from 1988 to 2016 earlier, and we'll now continue with constructing the training set with data from 1988 to 2015 and the testing set with data from 2016:

>>> data_raw = pd.read_csv('19880101_20161231.csv', index_col='Date')>>> data = generate_features(data_raw)>>> start_train = '1988-01-01'>>> end_train = '2015-12-31'>>> start_test = '2016-01-01'>>> end_test = '2016-12-31'>>> data_train = data.ix[start_train:end_train]>>> X_train = data_train.drop('close', ...

Get Python Machine Learning By Example - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.