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 and Machine Learning Fundamentals

You're reading from   Artificial Intelligence and Machine Learning Fundamentals Develop real-world applications powered by the latest AI advances

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher
ISBN-13 9781789801651
Length 330 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Zsolt Nagy Zsolt Nagy
Author Profile Icon Zsolt Nagy
Zsolt Nagy
Arrow right icon
View More author details
Toc

Linear Regression with Multiple Variables


In the previous topic, we dealt with linear regression with one variable. Now we will learn an extended version of linear regression, where we will use multiple input variables to predict the output.

We will rely on examples where we will load and predict stock prices. Therefore, we will experiment with the main libraries used for loading stock prices.

Multiple Linear Regression

If you recall the formula for the line of best fit in linear regression, it was defined as y = a*x + b, where a is the slope of the line, b is the y-intercept of the line, x is the feature value, and y is the calculated label value.

In multiple regression, we have multiple features and one label. Assuming that we have three features, x1, x2, and x3, our model changes as follows:

y = a1 * x1 + a2 * x2 + a3 * x3 + b

In NumPy array format, we can write this equation as follows:

y = np.dot(np.array([a1, a2, a3]), np.array([x1, x2, x3])) + b

For convenience, it makes sense to define 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