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
Bayesian Analysis with Python

You're reading from   Bayesian Analysis with Python Unleash the power and flexibility of the Bayesian framework

Arrow left icon
Product type Paperback
Published in Nov 2016
Publisher Packt
ISBN-13 9781785883804
Length 282 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Osvaldo Martin Osvaldo Martin
Author Profile Icon Osvaldo Martin
Osvaldo Martin
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Thinking Probabilistically - A Bayesian Inference Primer FREE CHAPTER 2. Programming Probabilistically – A PyMC3 Primer 3. Juggling with Multi-Parametric and Hierarchical Models 4. Understanding and Predicting Data with Linear Regression Models 5. Classifying Outcomes with Logistic Regression 6. Model Comparison 7. Mixture Models 8. Gaussian Processes Index

Multiple logistic regression


In a similar fashion as with the multiple linear regression, the multiple logistic regression is about using more than one independent variable. Let us try combining the sepal length and the sepal width. Remember that we need to pre-process the data a little bit:

df = iris.query(species == ('setosa', 'versicolor'))
y_1 = pd.Categorical(df['species']).codes
x_n = ['sepal_length', 'sepal_width']
x_1 = df[x_n].values

The boundary decision

Feel free to skip this section and jump to the model implementation if you are not much interested in how we can derive the boundary decision.

From the model, we have the following:

And from the definition of the logistic function, we have , when the argument of the logistic regression is zero, that is:

Reordering, we find the value of for which corresponds to the following expression:

This expression for the boundary decision has the same mathematical form as a line equation, with the first term being the intercept and the second the...

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