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: Build a regression model
From the course: Advanced Python in Excel: Machine Learning
Solution: Build a regression model
(upbeat music) - [Instructor] Let's walk through the solution to our regression model challenge. You started by setting up your Python environment in Excel and importing the dataset with the function, xl. Then, this new code start by importing the necessary libraries, so pandas for data manipulation and scikit-learn for building and evaluating your regression model. These libraries provide powerful tools for handling and analyzing data. Next, we convert the Month column to datetime format. We started selecting the features, such as Advertising_Spend, Economic_Indicator, and Seasonal_Factor in this case, and our target variables, so Sales. We split the data into training and testing sets and started to scale the features. We trained the machine learning model, in this case, linear regression on our data, and then, evaluated the model. For this, we use performance metrics like mean, absolute error, and also, r-squared. We print up these values and make the predictions on new data. As an…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.