# Build and Train Linear and Logistic Regression ML Models in Python Learn how to create, train, and test your first linear regression machine learning model in Python using the scikit-learn library. Linear regression and logistic regression are two of the most popular machine learning models today.

In the last lesson of this course, you learned about the history and theory behind a linear regression machine learning algorithm.

This tutorial will teach you how to create, train, and test your first linear regression machine learning model in Python using the `scikit-learn` library.

## Section 1: Linear Regression

### The Data Set We Will Use in This Tutorial

Since linear regression is the first machine learning model that we are learning in this course, we will work with artificially-created datasets in this tutorial. This will allow you to focus on learning the machine learning concepts and avoid spending unnecessary time on cleaning or manipulating data.

More specifically, we will be working with a data set of housing data and attempting to predict housing prices. Before we build the model, we’ll first need to import the required libraries.

### The Libraries We Will Use in This Tutorial

The first library that we need to import is pandas, which is a portmanteau of “panel data” and is the most popular Python library for working with tabular data.

It is convention to import `pandas` under the alias `pd`. You can import `pandas` with the following statement:

``import pandas as pd``

Next, we’ll need to import NumPy, which is a popular library for numerical computing. Numpy is known for its NumPy array data structure as well as its useful methods reshapearange, and append.

It is convention to import NumPy under the alias `np`. You can import `numpy` with the following statement:

``import numpy as np``

Next, we need to import matplotlib, which is Python’s most popular library for data visualization.

`matplotlib` is typically imported under the alias `plt`. You can import `matplotlib` with the following statement:

``````import matplotlib.pyplot as plt

%matplotlib inline``````

The `%matplotlib inline` statement will cause of of our `matplotlib` visualizations to embed themselves directly in our Jupyter Notebook, which makes them easier to access and interpret.

Lastly, you will want to import `seaborn`, which is another Python data visualization library that makes it easier to create beautiful visualizations using matplotlib.

You can import `seaborn` with the following statement:

``import seaborn as sns``

To summarize, here are all of the imports required in this tutorial:

``````import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

%matplotlib inline

import seaborn as sns``````

In future lessons, I will specify which imports are necessary but I will not explain each import in detail like I did here.

## What is Supervised Machine Learning

What is neuron analysis of a machine? Learn machine learning by designing Robotics algorithm. Click here for best machine learning course models with AI

## Python For Machine Learning | Machine Learning With Python

Python For Machine Learning | Machine Learning With Python

## Python For Machine Learning | Machine Learning With Python

Python For Machine Learning | Machine Learning With Python, you will be working on an end-to-end case study to understand different stages in the Machine Learning (ML) life cycle. This will deal with 'data manipulation' with pandas and 'data visualization' with seaborn. After this an ML model will be built on the dataset to get predictions. You will learn about the basics of scikit-learn library to implement the machine learning algorithm.

## Python for Machine Learning | Machine Learning with Python

Python for Machine Learning | Machine Learning with Python, you'll be working on an end-to-end case study to understand different stages in the ML life cycle. This will deal with 'data manipulation' with pandas and 'data visualization' with seaborn. After this, an ML model will be built on the dataset to get predictions. You will learn about the basics of the sci-kit-learn library to implement the machine learning algorithm.

## Python For Machine Learning | Machine Learning With Python

🔥 Get the pdf of this course: https://glacad.me/GetPDF_PythonML 🔥 Great Learning brings you this live session on 'Python for Machine Learning'. In this sessi...