Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying The Deep Learning with PyTorch Workshop
  • Table Of Contents Toc
The Deep Learning with PyTorch Workshop

The Deep Learning with PyTorch Workshop

By : Hyatt Saleh , Tim Hoolihan, Learnkart Technology Private Limited , Anuj Shah, Nahar Singh, Subhash Sundaravadivelu
5 (3)
close
close
The Deep Learning with PyTorch Workshop

The Deep Learning with PyTorch Workshop

5 (3)
By: Hyatt Saleh , Tim Hoolihan, Learnkart Technology Private Limited , Anuj Shah, Nahar Singh, Subhash Sundaravadivelu

Overview of this book

Want to get to grips with one of the most popular machine learning libraries for deep learning? The Deep Learning with PyTorch Workshop will help you do just that, jumpstarting your knowledge of using PyTorch for deep learning even if you’re starting from scratch. It’s no surprise that deep learning’s popularity has risen steeply in the past few years, thanks to intelligent applications such as self-driving vehicles, chatbots, and voice-activated assistants that are making our lives easier. This book will take you inside the world of deep learning, where you’ll use PyTorch to understand the complexity of neural network architectures. The Deep Learning with PyTorch Workshop starts with an introduction to deep learning and its applications. You’ll explore the syntax of PyTorch and learn how to define a network architecture and train a model. Next, you’ll learn about three main neural network architectures - convolutional, artificial, and recurrent - and even solve real-world data problems using these networks. Later chapters will show you how to create a style transfer model to develop a new image from two images, before finally taking you through how RNNs store memory to solve key data issues. By the end of this book, you’ll have mastered the essential concepts, tools, and libraries of PyTorch to develop your own deep neural networks and intelligent apps.
Table of Contents (8 chapters)
close
close

3. A Classification Problem Using DNNs

Activity 3.01: Building an ANN

Solution:

  1. Import the following libraries:
    import pandas as pd
    import numpy as np
    from sklearn.model_selection import train_test_split
    from sklearn.utils import shuffle
    from sklearn.metrics import accuracy_score
    import torch
    from torch import nn, optim
    import torch.nn.functional as F
    import matplotlib.pyplot as plt
    torch.manual_seed(0)
  2. Read the previously prepared dataset, which should have been named dccc_prepared.csv:
    data = pd.read_csv("dccc_prepared.csv")
    data.head()

    The output should be as follows:

    Figure 3.14: dccc_prepared.csv

  3. Separate the features from the target:
    X = data.iloc[:,:-1]
    y = data["default payment next month"]
  4. Using scikit-learn's train_test_split function, split the dataset into training, validation, and testing sets. Use a 60:20:20 split ratio. Set random_state to 0:
    X_new, X_test, \
    y_new, y_test = train_test_split(X, y, test_size=0.2, \
      ...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
The Deep Learning with PyTorch Workshop
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon