Skip to Main Content
Python Machine Learning By Example
book

Python Machine Learning By Example

by Yuxi (Hayden) Liu, Ivan Idris
May 2017
Beginner to intermediate content levelBeginner to intermediate
254 pages
6h 24m
English
Packt Publishing
Content preview from Python Machine Learning By Example

Stock price prediction with regression algorithms

Now that we have learned three (or four if you would say) commonly used and powerful regression algorithms and performance evaluation metrics, why don't we utilize all of these in solving our stock price prediction problem?

We have generated the features that we need earlier, and now we will continue with constructing the training set based on data from 1988 to 2014:

>>> import datetime>>> start_train = datetime.datetime(1988, 1, 1, 0, 0)>>> end_train = datetime.datetime(2014, 12, 31, 0, 0)>>> data_train = data.ix[start_train:end_train]  

All fields in the dataframe data (defined in the code from the beginning section) except 'close' are feature columns, and 'close' is the target column:

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Machine Learning by Example - Third Edition

Python Machine Learning by Example - Third Edition

Yuxi (Hayden) Liu
Python: Deeper Insights into Machine Learning

Python: Deeper Insights into Machine Learning

Sebastian Raschka, David Julian, John Hearty
Python: Real World Machine Learning

Python: Real World Machine Learning

Prateek Joshi, John Hearty, Bastiaan Sjardin, Luca Massaron, Alberto Boschetti

Publisher Resources

ISBN: 9781783553112Supplemental Content