This repository contains a machine learning model for sales prediction using Python. The model utilizes linear regression to forecast sales based on advertising data.
This project illustrates the process of building a sales prediction model in Python, employing machine learning techniques. The dataset employed in this project, "Advertising.csv," encompasses data on advertising expenditures across TV, radio, newspapers, as well as corresponding sales figures.
Follow these steps to construct and assess the sales prediction model:
-
Import Libraries: Start by importing the essential Python libraries for data manipulation and visualization.
-
Import Dataset: Load the dataset from the "Advertising.csv" file into a Pandas DataFrame for analysis.
-
Data Visualization: Explore the dataset through data visualization techniques. Generate a pairplot and a heatmap to visualize relationships and correlations between variables.
-
Data Preprocessing: Preprocess the data, including feature scaling, and divide the dataset into training and testing sets.
-
Linear Regression Model: Develop a linear regression model using scikit-learn. Train the model using the training dataset.
-
Model Evaluation: Evaluate the model's performance using common regression metrics such as Mean Absolute Error (MAE), Mean Squared Error (MSE), Square Root of Mean Absolute Error (RMSE), and R-squared (R2) score.
This project demonstrates the application of machine learning, specifically linear regression, for sales forecasting based on advertising data. The model is a valuable tool for making sales forecasts and optimizing advertising strategies.