Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Artificial Intelligence with Python

You're reading from   Artificial Intelligence with Python A Comprehensive Guide to Building Intelligent Apps for Python Beginners and Developers

Arrow left icon
Product type Paperback
Published in Jan 2017
Publisher Packt
ISBN-13 9781786464392
Length 446 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Prateek Joshi Prateek Joshi
Author Profile Icon Prateek Joshi
Prateek Joshi
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Introduction to Artificial Intelligence FREE CHAPTER 2. Classification and Regression Using Supervised Learning 3. Predictive Analytics with Ensemble Learning 4. Detecting Patterns with Unsupervised Learning 5. Building Recommender Systems 6. Logic Programming 7. Heuristic Search Techniques 8. Genetic Algorithms 9. Building Games With Artificial Intelligence 10. Natural Language Processing 11. Probabilistic Reasoning for Sequential Data 12. Building A Speech Recognizer 13. Object Detection and Tracking 14. Artificial Neural Networks 15. Reinforcement Learning 16. Deep Learning with Convolutional Neural Networks

Stock market analysis

We will analyze stock market data in this section using Hidden Markov Models. This is an example where the data is already organized timestamped. We will use the dataset available in the matplotlib package. The dataset contains the stock values of various companies over the years. Hidden Markov models are generative models that can analyze such time series data and extract the underlying structure. We will use this model to analyze stock price variations and generate the outputs.

Create a new python file and import the following packages:

import datetime 
import warnings 
 
import numpy as np 
import matplotlib.pyplot as plt 
from matplotlib.finance import quotes_historical_yahoo_ochl\ 
        as quotes_yahoo 
from hmmlearn.hmm import GaussianHMM 

Load historical stock market quotes from September 4, 1970 to May 17, 2016. You are free to choose any date range you wish.

# Load historical stock quotes from matplotlib package  
start = datetime.date(1970, 9, 4)  
end =...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image