Easy AI with Python
May 21, 2010 1:23 PM Subscribe
Easy AI with Python. High school-level introduction to a few artificial intelligence concepts, with relatively short open source Python code snippets.
I've fished the links out for you (some in the presentation don't work).
Data Mining with Neural Nets (aka "SQL can't do that.")
Mastermind
Bayesian Classifier
Eight Queens
Alphametics
Sudoku
Generic Puzzle-solving Framework
I've fished the links out for you (some in the presentation don't work).
Data Mining with Neural Nets (aka "SQL can't do that.")
Mastermind
Bayesian Classifier
Eight Queens
Alphametics
Sudoku
Generic Puzzle-solving Framework
adipocere: "Prolog was there first."
It's been interesting (and somewhat amusing) to watch the mainstream programming world finally come around to seeing functional programming as practical and important. Since that was triggered by multicore and The Cloud, I wonder what sort of hardware or software architectural shift it will take to cause the mainstream to discover the value of logic programming languages like Prolog. Whatever it is, I hope it arrives soon.
posted by vanar sena at 2:04 PM on May 21, 2010 [5 favorites]
It's been interesting (and somewhat amusing) to watch the mainstream programming world finally come around to seeing functional programming as practical and important. Since that was triggered by multicore and The Cloud, I wonder what sort of hardware or software architectural shift it will take to cause the mainstream to discover the value of logic programming languages like Prolog. Whatever it is, I hope it arrives soon.
posted by vanar sena at 2:04 PM on May 21, 2010 [5 favorites]
David Lightman: [typing] What is the primary goal?
Joshua: You should know, Professor. You programmed me.
David Lightman: Oh, come on.
David Lightman: [typing] What is the primary goal?
Joshua: To win the game.
posted by blue_beetle at 2:33 PM on May 21, 2010 [1 favorite]
Joshua: You should know, Professor. You programmed me.
David Lightman: Oh, come on.
David Lightman: [typing] What is the primary goal?
Joshua: To win the game.
posted by blue_beetle at 2:33 PM on May 21, 2010 [1 favorite]
The mainstream programming world has always understood the potential of functional programming languages. We just hate them.
Because they make our brains hurt.
posted by ecurtz at 2:36 PM on May 21, 2010 [5 favorites]
Because they make our brains hurt.
posted by ecurtz at 2:36 PM on May 21, 2010 [5 favorites]
I don't think people find functional programming as impractical, just hard. I tried my hand at some XSLT recently and bounced off of it, then ended going with a SAX-like approach. I could see that an XSLT solution probably existed and that it was doable, but between the syntax of language (okay, kind of a stretch for XSLT to be called a language) itself and its functional nature (which I have had little chance to explore since Prolog), I was utterly stymied.
Maybe a little of the esoteric nature throws people, as well. A language can be great, but ... can it hook into this Win32 function? Okay, how do I talk to the mysql database? The faster very practical bits like that are addressed the more people who will try the language.
posted by adipocere at 2:38 PM on May 21, 2010
Maybe a little of the esoteric nature throws people, as well. A language can be great, but ... can it hook into this Win32 function? Okay, how do I talk to the mysql database? The faster very practical bits like that are addressed the more people who will try the language.
posted by adipocere at 2:38 PM on May 21, 2010
The mainstream programming world has always understood the potential of functional programming languages.
They let us determine that the man in the red shirt owns the zebra.
posted by GuyZero at 3:04 PM on May 21, 2010 [1 favorite]
They let us determine that the man in the red shirt owns the zebra.
posted by GuyZero at 3:04 PM on May 21, 2010 [1 favorite]
Functional programming languages != logic programming languages.
posted by kmz at 3:14 PM on May 21, 2010 [4 favorites]
posted by kmz at 3:14 PM on May 21, 2010 [4 favorites]
Thanks for posting this. I want to become familiar with python especially since most XBMC scripts are written in that language.
posted by sygyzy at 3:58 PM on May 21, 2010
posted by sygyzy at 3:58 PM on May 21, 2010
I don't think people find functional programming as impractical, just hard.
It's funny that you say that, because I think it cuts both ways.
I'm currently developing a fairly complex project which does low level programming in c, and high level in haskell. Whenever I get to program in haskell, it's a dream and moves so quickly, and c, no matter how good I'm getting with memory management, is a nightmare.
That being said, whenever I try to explain to my colleagues (who have some programming experience) what I'm doing, the c is initially easier to understand.
What it comes down to is a theory vs complexity tradeoff. You can write pretty sublime code in a language in Haskell, but it takes a long time to even understand it, let alone use it effectively. When you do though, it is concise, beautiful and fast.
C isn't a complex language - it has a certain beauty in being a really nice reflection of a what a contemporary computer actually is, e.g. memory, addresses, cycles and scheduling. And while this concepts are quite straight forward, I don't think it every gets easy to work with.
posted by Alex404 at 4:01 PM on May 21, 2010 [3 favorites]
It's funny that you say that, because I think it cuts both ways.
I'm currently developing a fairly complex project which does low level programming in c, and high level in haskell. Whenever I get to program in haskell, it's a dream and moves so quickly, and c, no matter how good I'm getting with memory management, is a nightmare.
That being said, whenever I try to explain to my colleagues (who have some programming experience) what I'm doing, the c is initially easier to understand.
What it comes down to is a theory vs complexity tradeoff. You can write pretty sublime code in a language in Haskell, but it takes a long time to even understand it, let alone use it effectively. When you do though, it is concise, beautiful and fast.
C isn't a complex language - it has a certain beauty in being a really nice reflection of a what a contemporary computer actually is, e.g. memory, addresses, cycles and scheduling. And while this concepts are quite straight forward, I don't think it every gets easy to work with.
posted by Alex404 at 4:01 PM on May 21, 2010 [3 favorites]
Tell me more about Easy AI with Python.
posted by gimonca at 4:04 PM on May 21, 2010 [10 favorites]
posted by gimonca at 4:04 PM on May 21, 2010 [10 favorites]
Why do you ask?
posted by Blazecock Pileon at 4:12 PM on May 21, 2010 [3 favorites]
posted by Blazecock Pileon at 4:12 PM on May 21, 2010 [3 favorites]
I wouldn't say that functional programming is hard, but it's different from the imperative programming most people are used to. You can't apply almost all your current knowledge like you could going from Python to Ruby, or even C.
About a year ago, I switched most of my programming over to Haskell, previous to that I was mainly a Python and C guy. The thought process required for righting Haskell programs is more like writing a regular expression than a Python program. Data filters through transformations and you end up with the final result, rather than a sequence of steps and manipulations.
posted by Vulpyne at 4:40 PM on May 21, 2010
About a year ago, I switched most of my programming over to Haskell, previous to that I was mainly a Python and C guy. The thought process required for righting Haskell programs is more like writing a regular expression than a Python program. Data filters through transformations and you end up with the final result, rather than a sequence of steps and manipulations.
posted by Vulpyne at 4:40 PM on May 21, 2010
C isn't a complex language - it has a certain beauty in being a really nice reflection of a what a contemporary computer actually is, e.g. memory, addresses, cycles and scheduling.
But a modern C compiler will optimize your code in ways that it the code longer reflects what is actually happening in the computer. Unfortunately this is hard to do due to the number of crazy things you are allowed to do in C.
posted by grouse at 4:48 PM on May 21, 2010 [1 favorite]
But a modern C compiler will optimize your code in ways that it the code longer reflects what is actually happening in the computer. Unfortunately this is hard to do due to the number of crazy things you are allowed to do in C.
posted by grouse at 4:48 PM on May 21, 2010 [1 favorite]
Functional programming language concepts are well accepted in modern languages and known by most programmers. Logic programming languages like Prolog are more of a curiosity.
posted by demiurge at 4:57 PM on May 21, 2010
posted by demiurge at 4:57 PM on May 21, 2010
Is it because of your mother that you want to use Python?
posted by Evilspork at 5:28 PM on May 21, 2010 [8 favorites]
posted by Evilspork at 5:28 PM on May 21, 2010 [8 favorites]
Did anyone else watch the part on IAC and want to play with the metafilter dataset?
Someone please do this! I would but I'm way to lazy at this time.
posted by GhostChe at 5:46 PM on May 21, 2010
Someone please do this! I would but I'm way to lazy at this time.
posted by GhostChe at 5:46 PM on May 21, 2010
demiurge: "Logic programming languages like Prolog are more of a curiosity."
On the contrary, much of what people are doing with the building and querying of RDF-based semantic web databases is a perfect fit for LP languages. Many of the implementations that are appearing now seem (to me) to be reinventions of the WAM, which has been around since the mid 80s.
posted by vanar sena at 1:04 AM on May 22, 2010 [1 favorite]
On the contrary, much of what people are doing with the building and querying of RDF-based semantic web databases is a perfect fit for LP languages. Many of the implementations that are appearing now seem (to me) to be reinventions of the WAM, which has been around since the mid 80s.
posted by vanar sena at 1:04 AM on May 22, 2010 [1 favorite]
For those who can't grok Python, there is a new functional programming language called Scala coming about.
Scala can be used as a normal standalone programming language, but because it runs on top of the Java virtual machine, Scala objects are treated as 'just another Java-class' in the vm, and therefore can you can quite easily mix the two languages and use the functional part of Scala for the problem solving qualities it has and return its outcome into the java-world. And Scala is quite hot at the moment! And because it has adopted the Actor-concept from Erlang, this lends itself well for concurrent programming.
Scala is used to solve the examples from Artificial Intelligence - A Modern Approach over at the google code project site at aima-scala.
posted by marcelm at 2:58 AM on May 22, 2010 [2 favorites]
Scala can be used as a normal standalone programming language, but because it runs on top of the Java virtual machine, Scala objects are treated as 'just another Java-class' in the vm, and therefore can you can quite easily mix the two languages and use the functional part of Scala for the problem solving qualities it has and return its outcome into the java-world. And Scala is quite hot at the moment! And because it has adopted the Actor-concept from Erlang, this lends itself well for concurrent programming.
Scala is used to solve the examples from Artificial Intelligence - A Modern Approach over at the google code project site at aima-scala.
posted by marcelm at 2:58 AM on May 22, 2010 [2 favorites]
Scala running on top java sounds slow, is it?
posted by shothotbot at 11:23 AM on May 22, 2010
posted by shothotbot at 11:23 AM on May 22, 2010
Scala compiles to java bytecode, so it shouldn't be much different to java in performance.
posted by beerbajay at 8:31 AM on May 23, 2010
posted by beerbajay at 8:31 AM on May 23, 2010
Functional programming languages != logic programming languages.
No, but they rhyme a lot. At least, I'm finding that my experience writing programs in Prolog helps a lot conceptually as I pick up functional languages and increase my knowledge functional-style programming in multi-paradigm languages.
Logic programming languages like Prolog are more of a curiosity.
Totally disagree. For some problem domains, they're incredibly useful. In fact, I think it's a shame the dominant query language out there is SQL instead of Prolog or perhaps a tabled variant.
posted by weston at 2:01 PM on May 25, 2010
No, but they rhyme a lot. At least, I'm finding that my experience writing programs in Prolog helps a lot conceptually as I pick up functional languages and increase my knowledge functional-style programming in multi-paradigm languages.
Logic programming languages like Prolog are more of a curiosity.
Totally disagree. For some problem domains, they're incredibly useful. In fact, I think it's a shame the dominant query language out there is SQL instead of Prolog or perhaps a tabled variant.
posted by weston at 2:01 PM on May 25, 2010
« Older Clyde "Champion" Barrow Gang Collection | Does he do the Carlton too? Newer »
This thread has been archived and is closed to new comments
posted by adipocere at 1:56 PM on May 21, 2010