Talk 2: Easy AI with Python
Decided to go to a talk that sounded relatively interesting regarding using Python to accomplish "easy AI" tasks. Judging from the list of topics they've got up on the slide, these aren't going to be "easy" types of AI, just ways to easily implement them using Python.
First up is discussing how databases can be modeled using neural nets. Code source 496,908 in the ASPN code book. Core concept is how to model a database as a brain. Elements/fields are neurons, rows are connections between neurons. Columns denote competition.
Why not use SQL? Why use a neural net? You get to make generalizations with this, and survive with missing data. Whereas SQL would fail if you're missing rows or columns, a neural network can still do some work with it. Also provides the ability to do things with very small data sets.
(And now Vox demands I hit enter twice... I weep.)
So neural nets let you fire up neurons and then see the status of others. You can touch one, give it a certain charge/weight, then weight some others, and then see the connections. This is really interesting! The code to compute the activation level of a neuron is less than a dozen lines. That's it. The full program to model a database is about 100 lines of Python. You can then probe anything within the data set and see how it models.
Next AI is about the game Mastermind. This is ASPN cookbook recipe #496,907. So the idea is how do you make smart probes into a given search space. The basic code takes only 30 lines to solve the problem. (He's talking about some optimizer - pysco? psyco? And suggests writing compare functions in C to get speeeeeeeeeeed! He seems to love optimization.)
(They just passed around a signup sheet. Kinda lame, but being the consumer whore that I am, I filled it out. Go me.)
Apparently 'pick random' will beat Mastermind in about 7 tries on average. That's better than I expected. He's going through a bunch of optimizations, pick the random option that is most unique/will tell you the most, or pick the one that divides the search space most evently. Also, doing intelligent things on random samples of a really large search space (sample the options, evaluate them, pick one).
Next up is sudoku style puzzles. "A fantastic waste of time!" He says everybody should solve one or two manually to get the idea, then go write a solver in Python. The sudoku search space is so huge, you don't want to do an exhaustive search. You have to use constraints in this one.
You know rows can't repeat digits, as well as columns, and groups of nine. So you use that information to narrow it down a lot already. (The final project takes 56 lines of code, and that includes copious comments, he claims.) The idea is, you can easily determine what possibilities a cell has. "Oh, this one could be 1, 2, 3, 4, or 8. However, this cell can only be 1 or 7." So, you take the cell that has the fewest possibilities, and just randomly pick one.
You then repeat these steps. Recalculate possibilities for that row/column/subgroup, and then pick the one with the fewest possibilities, and run it again. Hurrah! That's pretty simple and straightforward. I don't know that it's a particularly amazing display of logical deduction, but it's neat.
Next up, writing a Bayesian Classifier. He says the easy, easy part is to write the bayesian part, the harder part is actually training it and parsing your input. Apparently to be mathematically correct you have to know the joint probabilities of things, but the idea behind Bayesian (in particular?) is that it multiples the probabilities of individual data points, which works most of the time.
Talk over shortly.