Skip to content
Latest commit ef6c60f Jul 5, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information. Update readmes (#41) Sep 13, 2017
ch08.ipynb some minor comments added Jul 5, 2018 make out-of-core section stand-alone executable in notebook Apr 25, 2018
movie_data.csv.gz update tests Sep 2, 2017

Python Machine Learning - Code Examples

Chapter 8: Applying Machine Learning to Sentiment Analysis

Chapter Outline

  • Artificial neurons – a brief glimpse into the early history of machine learning
    • The formal definition of an artificial neuron
    • The perceptron learning rule
  • Implementing a perceptron learning algorithm in Python
    • An object-oriented perceptron API
    • Training a perceptron model on the Iris dataset
  • Adaptive linear neurons and the convergence of learning
    • Minimizing cost functions with gradient descent
    • Implementing an Adaptive Linear Neuron in Python
    • Improving gradient descent through feature scaling
    • Large scale machine learning and stochastic gradient descent
  • Summary

A note on using the code examples

The recommended way to interact with the code examples in this book is via Jupyter Notebook (the .ipynb files). Using Jupyter Notebook, you will be able to execute the code step by step and have all the resulting outputs (including plots and images) all in one convenient document.

Setting up Jupyter Notebook is really easy: if you are using the Anaconda Python distribution, all you need to install jupyter notebook is to execute the following command in your terminal:

conda install jupyter notebook

Then you can launch jupyter notebook by executing

jupyter notebook

A window will open up in your browser, which you can then use to navigate to the target directory that contains the .ipynb file you wish to open.

More installation and setup instructions can be found in the file of Chapter 1.

(Even if you decide not to install Jupyter Notebook, note that you can also view the notebook files on GitHub by simply clicking on them: ch08.ipynb)

In addition to the code examples, I added a table of contents to each Jupyter notebook as well as section headers that are consistent with the content of the book. Also, I included the original images and figures in hope that these make it easier to navigate and work with the code interactively as you are reading the book.

When I was creating these notebooks, I was hoping to make your reading (and coding) experience as convenient as possible! However, if you don't wish to use Jupyter Notebooks, I also converted these notebooks to regular Python script files (.py files) that can be viewed and edited in any plaintext editor.

You can’t perform that action at this time.