I always wanted to create an Artificial Intelligence, I should probably start small, like this:
Let’s imagine a web page where there is a list of links to your favorite websites.
- My blog
Now the goal would be that every time we display that page, the system would re order that list based on what the user is most likely gonna choose.
If I remember well what my I learned a few years ago in class, the main concept behind the AI is having a choice to make and different outcomes. Each time you have to make a choice, you should have a list of possible options and you have to value each option. The hard part is to generate that value using a heuristic function.
To calculate those value, the heuristic function would take the current state as a parameter and then have a strategy to guess which option is the best. In my example there is only one choice to make (order the link) and then the scenario is over. In a more complex example like a tic tac toe, the system would have multiple decision to take one after the other in order to win.
My heuristic function will be simple, for each scenario, I will save the following variables : day, time , user and outcome. So each time the web page will be display, the system will get those value from the current state (exept for the outcome) and try to find similar past saved situation. Based on the result, the heurisitic function will give a hit rate for each link. The link will be ordered by that value. In other words, the value each option, the system will look into a list of past events and try to guess which link is more likely to be chosen.
Examples of patterns:
-60% of all time the user Ted has clicked on “my blog” link.
Outcome: the “my blog” link will have a value of 60% hit rate.
-The last 15 minutes, the user Ted has clicked 80% of the time on the “weather” link.
Outcome: the “weather” link will have a 80% hit rate.
-Every Saturday(we are Saturday btw) the user Ted never click on “facebook”.
Outcome: the “facebook” link will be last with a 0% hit rate.
We could express the 3 previous patterns with the following pseudo queries:
- USER: Search for past scenario where user = the current user.
- TIME: Search for past scenario where time is “near” right now.
- DAY: Search for past scenario where day = today’s day.
Using the following table:
- Events: id | user_id | time | day | link_id
Now, imagine that I got the following results based on the 3 previous queries.
The overall column could simply be a average of all the other columns or we could add a factor to each column. For example, the “time” result would count twice as much as the tow other ones.