Publications by Gary Hutson

Python Virtual Environments and package dependencies with a requirements.txt

17.01.2022

This tutorial has been borne out of the ability to port my development environments around. Most times I have to create requirements files to specify the dependent packages to be created in my virtual environments.Creating virtual environmentsTo learn how to create virtual environments, see below:Anaconda: https://hutsons-hacks.info/creating-and-...

6183 sym 8 img

Build a Transformers Game – using classes and object orientation concepts

13.04.2022

Learn how object orientated programming works in Python. The video attached shows how to build a simple Transformers battle game and familiarise yourself with the knowledge of classes.This video takes you through:Classes and initialisationMethodsProperties / AttributesInheritanceInstead of me writing all this down, it is better to watch the video...

695 sym 2 img

Fundamental building blocks in Python – Sets, Lists, Dictionaries and Tuples

13.04.2022

I have been working hard to compile a whole set of videos that help you to understand the core data structures that underpin the really powerful Python programming language.TuplesFor tuples, you can view the code here, on GitHub. I would recommend you watch the video, pull the code linked here and code along.Essentially, tuples are immutable, mea...

1812 sym 2 img

Building a PyTorch binary classification multi-layer perceptron from the ground up

03.05.2022

This assumes you know how to programme in Python and know a little about n-dimensional arrays and how to work with them in numpy (don’t worry if you don’t I got you covered).PyTorch is a pythonic way of building Deep Learning neural networks from scratch. This is something I have been learning over the last 2 years, as historically my go to d...

24136 sym Python (13000 sym/22 pcs) 6 img

Working with multiple arguments in a Python function using args and kwargs

17.05.2022

Fork Star Watch Download Issue When I first started programming in Python this used to trip me up all the time. Hopefully through my pain I have managed to find a way to convey just how simple this concept is.Working with argsThese functions allow you to extend your function massively, as when you design functions, you don’t want to l...

7703 sym

Narly NamedTuples in Python

23.05.2022

Fork Star Watch Download Issue NamedTuples are an excellent way to make your Python code more useful and readable. In short a NamedTuple is an alternative to the built-in tuple . This extension type enhances standard tuples so that their elements can be accessed by both their attribute name and the positional index.This is really powe...

3944 sym 12 img

I know dictionaries, but what is a DefaultDict?

13.06.2022

Fork Star Watch Download Issue The supporting repository and code file is: https://github.com/StatsGary/PyHacks-Tutorials/blob/main/28_defaultdict.py.This is aimed as a short article to explain why you would want to use default dictionaries. What is a defaultdict I hear you ask?A defaultdict is a container like dictionary present in the...

2842 sym 4 img

Build a PyTorch regression MLP from scratch

05.08.2022

Fork Star Watch Download Issue In this post we will go through how to build a feed forward neural network from scratch, with the awesome PyTorch library. This library was developed by researchers in Meta (Facebook) to enable them to process natural language with ease. Here I will show you how to extend this to some of your more common t...

19773 sym 16 img

Hyperparameter tuning a Transformer with Optuna

08.08.2022

This blog assumes you know a little about transformers and their architecture. To get to grips with the transformer we have used for this example – check out how the BERT infrastructure works: Once you have watched that video we will load a special version of this model called ELECTRA that is a new pretraining approach which trains two transfor...

10062 sym 10 img

Automating and downloading Google Chrome images with Selenium

19.05.2022

Fork Star Watch Download I love Nottingham Forest and have been trying to find a way to include them in one of my tutorials, as they are in the play-offs to go into the top flight leagues. This tutorial allows you to download images from Selenium and automate Googl...

5132 sym 8 img