Loading...
Menu

Reinforcement Learning in Python

Reinforcement Learning in Python (FREE BONUS Included)

Shakespir Edition

Copyright © 2017 by George Letton

Shakespir Edition, License Notes

Thank you for downloading this ebook. This book remains the copyrighted property of the author, and may not be redistributed to others for commercial or non-commercial purposes. If you enjoyed this book, please encourage your friends to download their own copy from their favorite authorized retailer. Thank you for your support.

[]

Wait! Before you start… Get Your FREE BONUSES:

FREE BONUS 1:

—> Click here to download this FREE COURSE to help you make your own SOFTWARE FAST! This FREE BONUS will be removed within 24 hours! <—

 

 

 

 

 

 

 

 

P.S Please if the link above doesn’t work go here:

 

>http://make-your-own-software-fast.weebly.com <

 

FREE BONUS 2:

—> [* Click here to download this 100% FREE ONLINE COURSE: JAVA FOR BEGINNERS! This FREE BONUS will be removed within 24 hours! ][<—*]

 

 

 

 

 

 

 

 

P.S Please if the link above doesn’t work go here:

 

>http://reinforcement-learning-free-course.weebly.com<

Copyright 2017 by George Letton – All rights reserved.

This document is geared towards providing exact and reliable information in regards to the topic and issue covered. The publication is sold with the idea that the publisher is not required to render accounting, officially permitted, or otherwise, qualified services. If advice is necessary, legal or professional, a practiced individual in the profession should be ordered.

- From a Declaration of Principles which was accepted and approved equally by a Committee of the American Bar Association and a Committee of Publishers and Associations.

In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved.

The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly.

Respective authors own all copyrights not held by the publisher.

The information herein is offered for informational purposes solely, and is universal as so. The presentation of the information is without contract or any type of guarantee assurance.

The trademarks that are used are without any consent, and the publication of the trademark is without permission or backing by the trademark owner. All trademarks and brands within this book are for clarifying purposes only and are the owned by the owners themselves, not affiliated with this document.

Table of Contents

 

Introduction

Chapter 1: Intelligence and Artificial Intelligence

Chapter 2: Machine Learning

Chapter 3: Neurons and Neural Networks

Chapter 4: Deep Learning

Chapter 5: Mathematical Prerequisites

Chapter 6: Computer Languages

Chapter 7: Python

Chapter 8: A Simple Example

Chapter 9: Regression and Support Vector Machines

Chapter 10: BONUS

Introduction

Let me tell readers a few words about the book, “Reinforcement Learning In Python”

This book contains essential information as you begin a study of artificial intelligence. Before you start this book ask yourself these questions:

*
p<>{color:#000;}. What do you know about artificial intelligence, reinforcement learning and the Python computing language?

*
p<>{color:#000;}.

*
p<>{color:#000;}. Are you keen to use them, to learn more about them?

This little book will tell you about starting them in a basic manner that does not confuse the reader with jargon. It will tell you about intelligence, artificial Intelligence, machine learning, neurons, neural networks, deep learning and prerequisites in knowledge of mathematics and computer languages.

There are 9 chapters which include:

*
p<>{color:#000;}. Intelligence and Artificial Intelligence

*
p<>{color:#000;}. Machine Learning

*
p<>{color:#000;}. Neural Networks

*
p<>{color:#000;}. Deep Learning

*
p<>{color:#000;}. Mathematical Prerequisites

*
p<>{color:#000;}. Computer Languages

*
p<>{color:#000;}. Python

*
p<>{color:#000;}. A simple Example

*
p<>{color:#000;}. Regression and Support Vector Machines

Each chapter will provide a stepping-stone to further exploration if so desired.

Onto Chapter 1.

Chapter 1: Intelligence and Artificial Intelligence

Intelligence: This is the ability to acquire data, retain it and use it.

Artificial intelligence: This is the ability of a machine to mimic intelligent behavior.

A program that says yes if it sees one or no if it does not see one is not an example of a machine, which has got artificial intelligence. It never goes beyond this. Its actions are determined by the instructions coded into it.

Even, Deep Blue, the computer, which IBM developed to beat Gary Kasparov – the world chess champion – does not exhibit artificial intelligence.

This computer has a database of millions and millions of chess moves so if an opponent makes a certain move, the computer is able to check that move because it has that move programmed into it. It does not learn from the actions of who it is playing against.

Recent developments in computing have seen the creation of programs that learn from their mistakes rather than being programmed to perform an action in response to a stimuli. Programs have been written which play all the Atari games.

In some games such as Video Pinball, the success of the program is vastly better than that of a human while, in some, such as Montezuma’s Revenge there has been no success for the program whatsoever.

Chapter 2: Machine Learning

Machine learning is a type of artificial intelligence that gives computers the ability to learn to do something rather than be exactly programmed to do it.

Machine learning algorithms look for patterns in data then adjust the action of the machine accordingly.

Machine learning is categorized as either supervised, where data sets are provided that the program learns from, or unsupervised – where the program learns from input.

Chapter 3: Neurons and Neural Networks

Neuron: The neuron is a cell, located in the brain, which is the most basic operating unit of the brain. Neurons deliver information to other cells throughout the body such as those in the nervous system, the musculature or the glands.

Neural Networks: A neural network is hardware or software mimicking what is believed to be the actions of neurons in the brain. A neural network consists of an assembly of interconnected neural units. A neural unit is often called a perceptron.

A neural unit is the equivalent in the system of a neuron in the brain. The action of one neural unit will influence the actions of adjacent units. The action consists of summation functions, which are often bounded.

The most important feature of these systems is that they learn independently to behave correctly rather than being specifically programmed to perform these behaviors. The virtue of this is that it is very difficult, if not impossible, to write programs which will produce the desired behaviors.

Chapter 4: Deep Learning

In a neural network, there are inputs that get processed by what are called layers and from the layers comes the output.

Neural networks have the term depth applied to them. Depth refers to the number of layers.

A neural network must have at least one layer. If there is more than one layer then the layers form a hierarchy where processing in a layer depends on what is in the previous layer. “Deep learning” refers to a network where there are many layers.

Reinforced learning is a method of training machines that is akin to training a dog where there are rewards and punishments for actions. The program has finished its learning when it achieves its objectives consistently.

Chapter 5: Mathematical Prerequisites

The process of reinforcement learning applied to programs is very mathematical but does not need mathematics beyond undergraduate level.

The mathematics needed for artificial intelligence and reinforced learning is quite extensive. Among the mathematical topics you will need are the following:

#
p<>{color:#000;}. Linear algebra: you will need to work with a range of topics within linear algebra. You will need to be familiar with arrays, which will be treated as matrices. You will also do a lot of work with vectors.

#
p<>{color:#000;}. Differential calculus: you must be familiar with the chain rule of differentiation for a process called back propagation.

#
p<>{color:#000;}. You will use stochastic gradient descent, which is a topic from numerical optimization.

#
p<>{color:#000;}. You are going to be using the exponential and logarithmic functions, their translations along with their graphs.

#
p<>{color:#000;}. Finally you will need to recall some statistics and probability. Not the cute little bar graphs of junior high but Bayes theorem, probability distributions generally, specifically the binomial and Gaussian distributions.

Chapter 6: Computer Languages

Most computer languages have been, or are being used for machine learning, even JavaScript. If you look up “progur neural network JavaScript” in Google and take the first hit of 578,000 of them that you get on this topic, you will get a brilliant article about using JavaScript for machine learning. About the fifth or sixth reference there is a very clever page that shows you how to create a neural network for telling whether a name is male or female.

When neural programming, it is often useful to use a low-level language such as C or C++. The R language has been extensively used and there are many websites devoted to its use in machine learning. Other well-known languages, which are often used in this field, are Java, Prolog and Lisp.

The language that gets the most recommendation though is Python. The next chapter is about this wonderful computer language.

Chapter 7: Python

Python is classified as a high level scripting language. It is an interpreted language, which means that it is compiled line by line. It is ideal for the high-speed processing of machine learning modules.

There are many machine libraries available written for the use of Python programmers. Among the libraries available are TensorFlow, SciKit and Theano.

Python is already installed on the latest Mac computers. Sadly, it is not available on Windows computers. You will have to go to Google and type in “getting Python on a PC” and follow the directions on the many websites in order to install it on a PC.

This book will not instruct you on how to program in Python. There are plenty of resources on the Internet and in books. The final chapter gives a simple program using Python and reinforced learning for your first task where you train one perceptron (electronic neuron) to learn some values.

Chapter 8: A Simple Example

Type the following into a Python editor then run it.

from numpy import exp, random, array, dot #1 This imports the exp, array, random, and dot functions from numpy a library of math objects and functions which comes with Python

inputs=array([[0,0,1],[1,0,1],[1,0,0],[0,1,1]]) #The perceptron is the array ([[0,0,1],[1,0,1],[1,0,0],[0,1,1]] whose elements are themselves the arrays [0,0,1],[1,0,1],[1,0,0],[0,1,1]

outputs = array([[1,0,0,1]]).T # T refers to the transpose of a matrix. Each of [0,0,1],[1,0,1],[1,0,0],[0,1,1] will be associated with 1,0,0,1. In other words [0,0,1]—>1, [1,0,1]—> 0, [1,0,0]—>0, [0,1,1]—>1

random.seed(1) #Apparently good practice to do this

synapticWts = 2*random.random((3,1))-1 #An important step in machine learning

for iteration in xrange(10000): # A loop where the perceptron learns

   output=1/(1+exp(-(dot(inputs, synapticWts ))))

    synapticWts += dot(inputs.T,(outputs

output)*output*(1-output))

print 1/(1+exp(-(dot(array([1,0,1]), synapticWts )))) # A bit of math magic which gets the result

Some may be wondering about the #. This indicates a comment in the program. A comment is a statement, which does not affect the program. Good programmers put lots of them in.

If you want to know more about this do a Google search neural network 9 lines python and take the first hit or reference. It is a good start.

Have a go at the JavaScript programs mentioned in the previous chapter. They are very, very good.

Chapter 9: Regression and Support Vector Machines

This is where things get pretty heavy. Regression is a technique widely used in statistics to get the best approximating function for a set of points. SVM’s are supervised learning methods and are utilized for the classification of data, regression to insure as good a model as possible and for the detection of outliers which are members of datasets which unusually different.

SVM’s are particularly suited for a situation where there are lots of dimensions and where the number of dimensions in the data exceeds the sample size. The way in which they operate is memory efficient.

SVM’s have certain situations where their performance is less than perfect. The situation can arise when the data has a number of features which greatly exceeds the sample size. SVM’s do not currently provide estimates of probability.

If you wish to learn more about SVM’s which are quite an advanced topic then Google search scikit and SVM.

Chapter 10: FREE BONUS

Wait! Before you go… Get Your FREE BONUSES:

FREE BONUS 1:

—> Click here to download this FREE COURSE to help you make your own SOFTWARE FAST! This FREE BONUS will be removed within 24 hours! <—

 

 

 

 

 

 

 

 

P.S Please if the link above doesn’t work go here:

 

>http://make-your-own-software-fast.weebly.com <

 

FREE BONUS 2:

—> [* Click here to download this 100% FREE ONLINE COURSE: JAVA FOR BEGINNERS! This FREE BONUS will be removed within 24 hours! ][<—*]

 

 

 

 

 

 

 

 

P.S Please if the link above doesn’t work go here:

 

>http://reinforcement-learning-free-course.weebly.com<

Artificial Intelligence is at the very cutting edge of technology.

If you wish to master it you must know its basics inside and out.

This book has thoroughly covered those basics.

Before you proceed further with this, you must master the material in the book to the extent that you understand what it says and are ready to tackle further study of this challenging topic.

Once you have mastered the material in this book, you are ready for all the other things that can be done with the ever increasing application of artificial intelligence!

Thank You and Good Luck!


Reinforcement Learning in Python

This book is an excellent introduction to reinforcement learning. This is a highly intuitive and accessible introduction to the recent major developments in reinforcement learning. Very well structured and well written. The book has a clear separation between theory and examples and also demonstrate many applications from the theory. The theoretical ideas are very well clarified. It covers several approaches (dynamic programming, monte carlo, temporal difference) and gives a lot of examples. It presents the subject with an excellent balance of mathematical, computational and intuitive material. It also includes plenty of real-life examples to explain the concepts and motivations for the algorithms. After reading this book you will definitely know the basics (even more) about reinforcement learning. You want to learn the basics of reinforcement learning in python in the shortest possible amount of time? You better grab this book and start reading​ it up! YOU WILL DISCOVER: Chapter 1: Intelligence and Artificial Intelligence Chapter 2: Machine Learning Chapter 3: Neurons and Neural Networks Chapter 4: Deep Learning Chapter 5: Mathematical Prerequisites Chapter 6: Computer Languages Chapter 7: Python Chapter 8: A Simple Example Chapter 9: Regression and Support Vector Machines Click The Download Button Now!

  • Author: George Letton
  • Published: 2017-06-02 15:20:11
  • Words: 2285
Reinforcement Learning in Python Reinforcement Learning in Python