Makers - Week 12
Tags: python, django, machinelearning, javascript
Published: 2020-03-17 16:37:23

They say all good things come to an end. When I think back to starting this journey, I feel a very mixed bag of emotions....mostly the term "how" comes into mind. 

How did I make it? How has it been the 16-18 weeks already? How am I a software developer?

Week 2 of the final project went so smoothly, i'm shocked to admit! All of the issues and answers we had to find during the later stages of last week were solved, and this led to a good old fashioned 5 day coding bender. % people on a dining room table with one unified goal - Pong!

One of the glaring issues from last week was API calls, more specially how can we speed them up so we can go from having 2 to over 10 a second. Our clever neural net needed the pixel data from the screen as quickly as possible. This needed to be sent from the Javascript frontend, to the Python backend (via Django) as quickly as possible to let our AI have the information. The AI would then give back a boolean (true === move paddle up) which then go along the pathway back to javascript and move the paddle up or down. We are thrilled to see that this could indeed happen, but only when the game speeds were incredibly slow.

Then Tom from the team had a brilliant Idea...Websockets. I remember reading about websockets when we were first getting involved with Ruby on Rails, and were trying to implement a live chat function. A websocket basically is an open session between the browser and server, allowing a 2 way path without a request having to be constantly sent. Messages can be therefore sent back and forth with the connection still open. We managed to implement this into our architecture, and with the collective minds of the group...it worked! Team Net-Positive 1 - Code 0!

The next biggest issue was how can we train our neural net in a speedy and efficient way once we know it worked? With some test runs made, we saw some of the basic functions working and the self adjusting weights of the network (back propagation) being put in to force. But based on some simple calculations, it would have needed tens of hours to even learn a small amount when being trained locally on one of our macbooks. This is where we discovered AWS, Amazons remote hosting capabilities. 

We managed to upload our first basic neural network onto this remote hosting site, and train the net on the tried and tested OpenAI Gym, on the original Atari Pong game! We anxiously uploaded the net and set the parameters, and went to bed wondering if little Bjorn would come out of the other side a better pong player? (We named our net Bjorn CYborg...see what we did there?) To our utter amazement, the next morning it had indeed improved, its performance had reduced from minus 21 (points let in against what it scored in an average 21 point game) to minus 17! We were ecstatic, Bjorn lives, and he was improving and LEARNING to play! We experimented with batch sizes, different cost functions, different number of hidden layers in the net, and different processors to train on, and overall found the right combinations. We could now train a new net to go from minus 21 to minus 11 in just 19 hours of training!

We were then able to tweak our own vanilla javascript game, and make the canvas as like for like as the Open AI gym so that we could load states of our net into the backend, and it would transfer what it had learned over to our version of the game....and actually be hard to beat! 

Over the rest of the week, our front end got more retro, our neural net started to learn more and more and our teamwork and camaraderie grew. I have to say, not just because it was the most interesting project, this was my favourite time at Makers. We were allowed to Flex our coding muscle, and come up with our own idea, and go tooth and nail to try and have something ready for presentation day after just 12 nights!

To say I am immensely proud of the team would be an understatement, I want to take the time to give a huge shout out to Asia, Jake, Nic and Tom for all their hard work and commitment over the past two weeks. 

Our final project can be found here: http://net-positive.herokuapp.com/ 

The next part of this post is more about life after Makers. I'm not really sure what that involves, and i'm not really sure how to feel about it. On one hand i feel relieved I completed the course and have lots to show for it, but on the other hand i genuinely enjoyed being back at school, and met some wonderful people along the way who i already dearly miss! That is obviously not helped by the recent outbreak of Covid-19, nor will that likely give the job market much to get up and shout about, however the next chapter awaits nonetheless, and it is time to get up and earn some money again.

I will continue this weekly blog through my job hunt and extended coding, fingers crossed this pandemic is short lived and the world can return to a normal pace sooner. I'm now off to sleep for a week and write a CV (is that what's it called?) before the job hunt starts on Monday.

Now possibly more than ever, please wish me luck as I explore the market in search of a job. 

I'm a developer - honest!

David