From the course: Advanced Python in Excel: Machine Learning

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: How would you solve this problem with ML?

Solution: How would you solve this problem with ML?

From the course: Advanced Python in Excel: Machine Learning

Solution: How would you solve this problem with ML?

(upbeat music) - [Instructor] Let's work through the solution to our challenge. We start by inputting the data frame using the XL function. Then we import the libraries that we need for predicting the stock prices. For this task, a supervised learning model like linear regression should be effective. First we import pandas for data manipulation and side keep learn for building and evaluating our machine learning model. Next, we convert the date column to daytime format and create the target variable. In this case, the next day's closing price. We drop the last row as these will have a null value in the next close and select the features. Open, high, low, close, and volume and the target. So the next close. Then we split the data into training and testing tests. We scale the features and train the machine learning model, the linear regression in this example. Finally, we evaluate the model. In here, we also use predicted next host to see and evaluate our predicted figure.

Contents