The Wayback Machine - https://web.archive.org/web/20211117144012/https://github.com/Atcold/pytorch-Deep-Learning
Skip to content
master
Switch branches/tags
Code

Latest commit

Hi Alfredo,

I realized that when we increase the batch_size = 5 to batch_size = 100, the accuracy goes above 100%. I proposed the following changes to correct it:


Change 1: 

Added one constant: 
total_values_in_one_chunck = batch_size * BPTT_T


Change 2:


Changed:
correct += (pred == target.byte()).int().sum().item()

To (in both def train(hidden) and def test(hidden)):
correct += (pred == target.byte()).int().sum().item()/total_values_in_one_chunck

(After this change, we get a number between 0 and 1 for each comparison,  to be added to the previous correct value, instead of a number between 0 and otal_values_in_one_chunck  (batch_size * BPTT_T)


Change 3:

Changed:
train_accuracy = float(correct) / train_size # train_size = num_of_chuncks

To:
train_accuracy = float(correct)*100 / train_size # train_size = num_of_chuncks

After these 3 changes, we get accuracy below 100 % for batch_size = 100 and above because what is now being added to the "correct" after each comparison is a percentage (between 0 and 1), which makes more sense to me to evaluate the equality rate of two vectors rather than total number of equal values.

Please let me know what you think. 

Thanks,
Gelareh
39fc6fa

Git stats

Files

Permalink
Failed to load latest commit information.

Deep Learning (with PyTorch) Binder

This notebook repository now has a companion website, where all the course material can be found in video and textual format.

🇬🇧   🇨🇳   🇰🇷   🇪🇸   🇮🇹   🇹🇷   🇯🇵   🇸🇦   🇫🇷   🇮🇷   🇷🇺   🇻🇳   🇷🇸   🇵🇹   🇭🇺

Getting started

To be able to follow the exercises, you are going to need a laptop with Miniconda (a minimal version of Anaconda) and several Python packages installed. The following instruction would work as is for Mac or Ubuntu Linux users, Windows users would need to install and work in the Git BASH terminal.

Download and install Miniconda

Please go to the Anaconda website. Download and install the latest Miniconda version for Python 3.7 for your operating system.

wget <http:// link to miniconda>
sh <miniconda*.sh>

Check-out the git repository with the exercise

Once Miniconda is ready, checkout the course repository and proceed with setting up the environment:

git clone https://github.com/Atcold/pytorch-Deep-Learning

Create isolated Miniconda environment

Change directory (cd) into the course folder, then type:

# cd pytorch-Deep-Learning
conda env create -f environment.yml
source activate pDL

Start Jupyter Notebook or JupyterLab

Start from terminal as usual:

jupyter lab

Or, for the classic interface:

jupyter notebook

Notebooks visualisation

Jupyter Notebooks are used throughout these lectures for interactive data exploration and visualisation.

We use dark styles for both GitHub and Jupyter Notebook. You should try to do the same, or they will look ugly. JupyterLab has a built-in selectable dark theme, so you only need to install something if you want to use the classic notebook interface. To see the content appropriately in the classic interface install the following: