Book Image

Building Machine Learning Systems with Python - Second Edition

By : Luis Pedro Coelho, Willi Richert
Book Image

Building Machine Learning Systems with Python - Second Edition

By: Luis Pedro Coelho, Willi Richert

Overview of this book

<p>Using machine learning to gain deeper insights from data is a key skill required by modern application developers and analysts alike. Python is a wonderful language to develop machine learning applications. As a dynamic language, it allows for fast exploration and experimentation. With its excellent collection of open source machine learning libraries you can focus on the task at hand while being able to quickly try out many ideas.</p> <p>This book shows you exactly how to find patterns in your raw data. You will start by brushing up on your Python machine learning knowledge and introducing libraries. You’ll quickly get to grips with serious, real-world projects on datasets, using modeling, creating recommendation systems. Later on, the book covers advanced topics such as topic modeling, basket analysis, and cloud computing. These will extend your abilities and enable you to create large complex systems.</p> <p>With this book, you gain the tools and understanding required to build your own systems, tailored to solve your real-world data analysis problems.</p>
Table of Contents (20 chapters)
Building Machine Learning Systems with Python Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using logistic regression


Contrary to its name, logistic regression is a classification method. It is a very powerful one when it comes to text-based classification; it achieves this by first doing a regression on a logistic function, hence the name.

A bit of math with a small example

To get an initial understanding of the way logistic regression works, let's first take a look at the following example where we have artificial feature values X plotted with the corresponding classes, 0 or 1. As we can see, the data is noisy such that classes overlap in the feature value range between 1 and 6. Therefore, it is better to not directly model the discrete classes, but rather the probability that a feature value belongs to class 1, P(X). Once we possess such a model, we could then predict class 1 if P(X)>0.5, and class 0 otherwise.

Mathematically, it is always difficult to model something that has a finite range, as is the case here with our discrete labels 0 and 1. We can, however, tweak the probabilities...