I was going to call this one “Me Learning” put maybe a bit too low brow!

Summary

For my Final year project I’m doing to use Machine learning to apply a neural network so that a bot can play Tetris. I’ll then set it up so that a player can play against it.

I’ve been studying Machine learning by doing the following course Machine Learning by Andrew Ng.

College Capstone Project - Tetris AI

For my project I will make a basic Tetris game and apply a neural network probably using a Deep Q learning algorithm to make an AI which can learn to play Tetris.

I’ll make the AI to be human level response so as it’ll be a fair game for users to play against. To differ it from other project online I also want it to learn from playing against someone.

Which will mean things like looking at when the other player will likely send blocks and to notice optimal times to send blocks to knock someone out.

It is going to be a very big challenge for myself as I’m starting from zero on my machine learning knowledge and have to relearn Python!

Machine Learning - Coursea

At the moment I’m working through Machine Learning by Andrew Ng (A free course).

So far I’ve found him easy to listen to and that he explains topics well.

In the two and a half weeks I have completed of the course I have learned about:

  • Gradient Descent
  • Cost function
  • Normal Equation
  • Polynomial Regression
  • Feature Scaling
  • Classification
  • Decision Boundaries
  • Logistic Regression

There is a lot of maths so far in the course, but he does go over multiplying matrices, some formulas to the point that I could understand them. (I studied engineering, so a lot of it I learnt before)

If you don’t find it sticking there is a guy 3Blue1Brown on youtube who goes over these topics really well and in a very visual way.

If you want to rush through and get your feet wet you can get away with not knowing the math too well to complete the week two assignment anyway.

I’m using a github repo by some nice people who converted the assignments into Python, so you can submit them as python!

I ran into trouble with the order of the matrices when trying to implement them as the order does not match the formula. It is more about using transpose (T) to make the matrices so that they can multiply out. So if you understand the matrix layout it will make sense so try think about the matrix layout.

I’m a bit disappointed in the assignments so far as they aren’t very code heavy but maybe it will change.

The answers to the three questions you need to complete for the first assignment are below.

Warm up exercise

A = np.eye(5)

Cost function formula.

J(θ) = 1/2m ∑(Xθ - y)^2

Computing Cost (for one variable)

J = (np.sum(np.power((np.dot(X, theta) - y),2)))/(2*m)

Gradient Descent formula.

θ = θ - α 1/m ∑(θTX - y)X

Gradient Descent (for one variable)

h = theta.dot(X.T)
theta = theta - alpha * (1/m) * ((h-y).dot(X))

Road Ahead -

Over the next week I plan to:

Thanks for reading and happy coding!