Nowadays, AI-related fields like Data Science and Machine Learning have become mainstream. Practically everyone can now become a data scientist. That’s, of course, a good thing, but unfortunately, people forget about what an AI system is. I prefer the notion by Patrick Winston from MIT:
Artificial Intelligence (or Intelligent Agent) is a system based on a mathematical model that acts optimally in an environment with certain constraints.
In this article, I would like to talk more about models.
So what makes a model a good one?
To keep it short, a good model (in my opinion every good model) should be a good representation of the problem. Or in other words, it must:
- Make distinctive features explicit.
- Expose constrains.
Unfortunately, because of platforms like Kaggle that give data in beautiful covers, simple tables, the majority of people think about AI as a task of finding some feature to predict a class or a continuous value, sometimes finding an object in images. But now I would like to show an example of another problem in the AI field that unfortunately it’s not taken as an example of AI.
The 8-Queens Problem
The 8-Queens problem is formulated as follows: An agent should place 8 queens on a chess table in such a way that no queen attacks other queens.
To solve this problem we need first to formulate a mathematical description of the problem. So let’s formulate it as an optimization problem:
- Performance function — the number of pairs of queens attacking each other.
- The state of the problem — the arrangement of queens on the chess table — we will use them to find its cost value.
- The method to solve — I chose the Genetic Algorithm.
The book “Artificial Intelligence — The Modern Approach” illustration shows the splitting of the table itself during the crossing-over. But unfortunately, sometimes it could violate the main rule of the problem — the queen’s number must be eight.
So what would be a better model to describe the chess table arrangement, without changing the number of queens during the crossing-over? What describes the place of queens on the table?
Of course coordinates! So, by describing the chromosomes as a list of coordinates of queens. But mutations are implementing as changing randomly the coordinates of a queen.
So as my last words, I would like to give you a piece of advice. If you want to become an AI researcher or AI Engineer I really recommend you to not stick to such technologies as Machine Learning and Neural Networks, especially to frameworks like sklearn or Keras. Learn better to build your own, like how we do at Sigmoid. And the most important learn to formulate problems and models to solve them.
BONUS: The python implementation.