Learn practical skills, build real-world projects, and advance your career

Linear Regresion with PyTorch

The dataset selected for this notebook is the Titanic dataset.

This dataset has several information where each row represents one person. The columns describe different attributes about the person including whether they survived, their age, their passenger-class, their sex, and the fare they paid. Finally the dataset is devided in training and evaluation data.

The training and evaluation data can be found in the following links:

This notebook is focused in the prediction of wheather a passenger survived or not, and it is build based on the following steps:

  1. Install depencies
  2. Import modules
  3. Download and dataset analysis
  4. Preparing the dataset for training
  5. Creating a Linear Regression model
  6. Training the model and fitting the data
  7. Making predictions using the trained model
  8. Saving the model
  9. Commiting and uploading the notebook

This notebook is based on the concepts from the first two lectures and as part of the Assignment 2 of the course Deep Learning with PyTorch, which you can find in the following links:

Step 1: Install dependencies
# Uncomment and run the commands below if imports fail
# !conda install numpy pytorch torchvision cpuonly -c pytorch -y
# !pip install matplotlib --upgrade --quiet
!pip install jovian --upgrade --quiet
|████████████████████████████████| 92kB 2.4MB/s eta 0:00:011 Building wheel for uuid (setup.py) ... done
Step 2: Import Modules
import torch
import jovian
import torchvision
import torch.nn as nn
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import torch.nn.functional as F
from torchvision.datasets.utils import download_url
from torch.utils.data import DataLoader, TensorDataset, random_split
/usr/local/lib/python3.6/dist-packages/statsmodels/tools/_testing.py:19: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead. import pandas.util.testing as tm