Code Monkey home page Code Monkey logo

linear_regression_demo's Introduction

linear_regression_demo

This is the code for "How to Make a Prediction - Intro to Deep Learning #1' by Siraj Raval on YouTube

##Overview This is the code for this video by Siraj Raval on Youtube. This is the 1st episode in my 'Intro to Deep Learning' series. The goal is to predict an animal's body weight given it's brain weight. The model we'll be using is called Linear Regression. The dataset we're using to train our model is a list of brain weight and body weight measurements from a bunch of animals. We'll fit our line to the data using the scikit learn machine learning library, then plot our graph using matplotlib.

##Dependencies

  • pandas
  • scikit-learn
  • matplotlib

You can just run pip install -r requirements.txt in terminal to install the necessary dependencies. Here is a link to pip if you don't already have it.

##Usage

Type python demo.py into terminal and you'll see the scatter plot and line of best fit appear.

##Challenge

The challenge for this video is to use scikit-learn to create a line of best fit for the included 'challenge_dataset'. Then, make a prediction for an existing data point and see how close it matches up to the actual value. Print out the error you get. You can use scikit-learn's documentation for more help. These weekly challenges are not related to the Udacity nanodegree projects, those are additional.

Bonus points if you perform linear regression on a dataset with 3 different variables

##Credits

The credits for the original code go to gcrowder. I've merely created a wrapper to get people started.

linear_regression_demo's People

Contributors

llsourcell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linear_regression_demo's Issues

Reading challenge file

The challenge.txt data file was in a different format than the brain_body.txt data file used for demo.py

To make it much more straightforward to do this work I'd suggest to either:

  1. Make a mention in the problem that knowing how to read in this different data format is also something that's necessary, and a link to somewhere to find out how to use pandas to read the new data format
    or
  2. Have both data files in the same format (i.e. both in fwf format)

Plot looks odd

Hey, i'm a little late to this show and was trying to go along with what siraj showed in his video, but my graph is coming out really weird. I downloaded his files as well and i get the same result.

Any insight will be appreciated

Running the Siraj code:
figure_1

It looks the same when i run it on ipython notebook

Scipy Still Required After Installing Requirements

Scipy is still required after the requirements are installed after running pip install requirements.txt on a Windows machine.

Traceback (most recent call last):
  File "demo.py", line 2, in <module>
    from sklearn import linear_model
  File "C:\Users\Tim\Miniconda3\lib\site-packages\sklearn\__init__.py", line 57, in <module>
    from .base import clone
  File "C:\Users\Tim\Miniconda3\lib\site-packages\sklearn\base.py", line 9, in <module>
    from scipy import sparse
ImportError: No module named 'scipy'

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.