Giter Club home page Giter Club logo

hakansenzeybek / lineerregressioncase Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 44 KB

In this project, I will build a simple linear regression model to predict sales based on TV marketing expenses. I will investigate three different approaches to this problem. I will use NumPy and Scikit-Learn linear regression models, as well as construct and optimize the sum of squares cost function with gradient descent from scratch..

Jupyter Notebook 93.82% Python 6.18%

lineerregressioncase's Introduction

Linear Regression for Sales Prediction

This project aims to build a simple linear regression model to predict sales based on TV marketing expenses. Three different approaches are investigated: using NumPy and Scikit-Learn linear regression models, as well as constructing and optimizing the sum of squares cost function with gradient descent from scratch.

1. Open the Dataset and State the Problem

The dataset used in this project is stored in the file data/tvmarketing.csv. It contains two fields: TV marketing expenses (TV) and sales amount (Sales). The goal is to build a linear regression model that can predict sales based on TV marketing expenses.

2. Linear Regression in Python with NumPy and Scikit-Learn

This section explores two different implementations of linear regression using popular Python libraries. The NumPy library is used to perform linear regression. The dataset is loaded, and the linear regression model is fitted to the data. The model's coefficients and performance metrics are evaluated and displayed. Scikit-Learn is a powerful machine learning library that provides various regression models. Here, the Scikit-Learn linear regression model is used to fit the data, and the model's coefficients and performance metrics are computed.

3. Linear Regression using Gradient Descent

This section introduces a manual implementation of linear regression using gradient descent. The sum of squares cost function is constructed, and gradient descent is used to optimize the model's coefficients. The process of finding the optimal coefficients and the cost function's convergence are explained.

4. Results

The results obtained from the different approaches are as follows:

Linear Regression with NumPy:

Predictions of sales: [ 9.40942557 12.7369904 20.34285287]

Linear Regression with Scikit-Learn:

Predictions of sales: [ 9.40942557 12.7369904 20.34285287]

Linear Regression using Gradient Descent:

Predictions of sales (Scikit-Learn): [ 9.40942557 12.7369904 20.34285287]

Predictions of sales (Gradient Descent): [ 9.40942557 12.7369904 20.34285287]

5. Analysis

The linear regression models built using NumPy, Scikit-Learn, and gradient descent all provide similar predictions for sales based on TV marketing expenses. The predicted sales amounts increase as the TV marketing expenses increase, indicating a positive linear relationship between these variables. The models' coefficients, performance metrics, and convergence can be further analyzed to assess the accuracy and reliability of the predictions. It is recommended to evaluate additional metrics such as mean squared error or R-squared to quantify the models' performance. Furthermore, visualizing the regression line and the predicted points can provide insights into the quality of the model's fit to the data.

lineerregressioncase's People

Contributors

hakansenzeybek avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.