Previously we were talking about building supervised learning models from scratch. And now it’s time to roll out big guns. I’m going to use the PyTorch library to build a model which is able to recognize handwritten digits. After writing everything from scratch It’s an amazing feeling of how PyTorch eases the process of developing and testing deep learning models. Let’s take a look at what I got.


Because we are going to use PyTorch it has to be installed on your machine. Also, libraries have to be imported into the python file. Here what we need:

Inspired by reading Stanislaw Lem works Golem XIV and Culture as Error. I read it in Russian and all quotes I translated myself so please let me know if something has been lost during translation.

In the Golem XIV Stanislaw Lem makes humans talk to the artificial super intelligent, which is in a state of recurring self-improvement. Golem level of Intelligence transcends human level and is able to gain level comprehension of the reality humans could only dream about. …

This abstract is a result of reading and notetaking of the Douglas Engelbart work Augmenting Human Intellect: A Conceptual Framework which was written in 1962.


The problem Engelbart invites us to tackle is urgent. Complexity of civilization organization and challenges we are discovering is growing exponentially and human intelligence, even though it is growing, is not growing fast enough. Especially human collective intelligence. As a result human civilization is not prepared to face complex challenges of today and tomorrow. We might face more and more catastrophic consequences for our inability to comprehend and solve complex problems. …

As we know there are a lot of levels of abstraction between the hardware we use and what we can see on the screen. We also hear that computers work with binaries which means the unit of data is 0 and 1 (or true and false). When we tell the computer to compute something, it can’t just take numbers and do a computation. First numbers have to be converted to binary and then the computation can be performed. I decided to dive into how computers do computations in binary. For simplicity of representation, I built all functions in python.



Previously we were learning how to create different parts of neural networks. To train different versions of our artificial intelligence we used abstract training data. And now the time has come to use real data.


We are going to teach our neural net to recognize handwritten digits with help of MNIST dataset. Also known as the “hello world problem” in the machine learning industry.

MNIST dataset contains 60 000 labeled data points (images) as training dataset and 10 000 testing dataset. Original data stored in binaries files so we will need to do some extraction work. …

My colleague at MIT Farzad inspired me to systematize my thoughts about the learning process I follow since I began to study computer and data science. In this article I will try to express a short and precise summary of critical parts of the learning process especially when you are self-tough.

Fog of war

When we are learning a completely new subject we don’t know what we don’t know. And we don’t have such a lecture as a professor who can map it for us. So we have to do it ourselves. At first I would focus on key concepts…

As you might know right now I’m MIT ReACT learner. This week we began a Computer Science course and the first assignment was to come up with the idea of using graph data structure. I thought I would use a knowledge example of a real world example of graph data structure. Also, I thought I should create one which will represent what we are going to learn through the program and the opportunity to show off during the class is priceless.

Knowledge Graph

Previously I already wrote about graphs data structure so I am not going to repeat myself and…

Last time we were talking about adding hidden layers to our neural network, and it did well solving binary classification tasks. But what if we have more entities in our ontology? Let’s figure out how to teach our neural net how to solve multiple entity classification problems!

Generating data

When it comes to the neural networks training dataset comes first! We will generate 3 segments of the dataset to demonstrate how to work with more than two classifications. Each segment will contain two dementia arrays of coordinates and we will specify the range of these points to group them together. Therefore each…

A look at hidden layers as we try to upgrade perceptrons to the multilayer neural network

In my first and second articles about neural networks, I was working with perceptrons, a single-layer neural network. And even though our AI was able to recognize simple patterns, it wasn’t possible to use it, for example, for object recognition on images. That’s why today we’ll talk about hidden layers and will try to upgrade perceptrons to the multilayer neural network.

Hidden Layers

Why do we need hidden layers? Perceptrons recognize simple patterns, and maybe if we add more learning iteration, they might learn how to recognize more complex patterns? Actually, no. …

Second generation and optimizing our neural network

graphic image of a neural network shaped like a brain
graphic image of a neural network shaped like a brain

In our previous article, we built from scratch a simple neural network that was able to learn and perform a very simple task. Today we will optimize our network, make it object-oriented, and introduce such concepts as learning rate and biases. And let’s add a fw simple but real-world cases so 0 and 1 turn into some sort of the story.


The same as last time, we are going to need only one external library to perform computation, NumPY, and, of course, Python itself.


Pavel Ilin

Software Engineer, AI researcher and Transhumanist.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store