views:

300

answers:

8

I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.

I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.

There are some books on AI on internet but they use Java , Python.

Now I have to apply AI techniques on web application.

Which language should i choose java or python.

I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php

I have also seen that python can also be used with php as well

So which way should I go and roughly how much it will take me to learn java

I have done java basics but that was 6 years ago

+2  A: 

You can use either Java or Python.A lot of resources are available for both languages.

I think following books might suit for your purpose.

Programming collective intelligence: building smart web 2.0

collective intelligence in action

Upul
Providing i don't know either , which will make my work easier as i know php only. I was always confused with java . do i have to learn , only core java or java servltes , java beans or JSP , J2EE.
Mirage
yes You should have good knowledge on core Java
Upul
+3  A: 

Does it really matter which language your books use? I mean, you're not gonna copy-paste those examples. And you'll learn to recognize basic constructs (functions, loops, etc) pretty fast. It's not like learning to read Chinese.

Talking about learning time, there's probably no definite answer to this question. I think the best is to look at examples of code both in java and python and see which seems 'nicer', easier and more familiar to you.

Good luck!

Nikita Rybak
A: 

Never use PHP for AI. Java or C/C++ is the best, but Python for fast development.

HKVN
Why should someone *never* use PHP for AI? PHP is used very frequently for many web based AI applications.
Coltin
It used PHP for frontend. Backend often is java.
HKVN
+2  A: 

You can use any language you like, as long as the server it's hosted on supports it. You can use HTML/JS as the user interface, and request results from the server with AJAX requests.

What answers those requests would be your AI code, and that can be anything you want. PHP makes it really simple to answer AJAX requests. Since you are already familiar with it I would recommend that, although if your AI is very sophisticated you may want to go with something a little more efficient, like C/C++.

Coltin
+2  A: 

Of the languages you've mentioned, you will probably find the most readily useful tools available in Java, especially for machine learning resources. A good example of this is WEKA, which is a popular data mining tool written in Java.

Machine learning algorithms are generally something you don't want to have to code from scratch if you don't have to. Although you would certainly learn a lot from doing so, they can take a significant amount of time to debug since it can often be hard to tell the difference between working and non-working behavior, e.g., they can sometimes fail to learn either with or without bugs, and they can also learn patterns with or without bugs.

I'd look for tools first, then decide on the language with the tool options in mind.

Joel Hoff
"I'd look for tools first" - erm, personally I'd look for the AI method first - there's a huge difference between the ways heuristic rule based systems, neural networks, genetic algorithms and fuzzy logic work - and between how they should be applied.
symcbean
A: 

Pretty much any language can be used to code pretty much anything - given the effort and will. But Python has more functional programming constructs which may be more useful when you are coding AI.

DavidG
+1  A: 

Which language should i choose java or python.

Here are a few things to consider:

  • java is more widely used (presumably more mature code "out there" to look at - but I haven't tested that out)

  • python is more prolific (you write faster in python than in java), and from learning the language to writing the code that you want takes less in python than in java

  • python is multi-paradigm, java is (almost) strictly OOP

  • java is compiled (whereas python is scripted); this means that java finds your errors at compilation; python at execution - this can make a big difference, depending on your development style/practices

  • java is more strictly defined and much more verbose than python. Where in java you have to formalize your contracts, in python you use duck-typing.

In the end, the best you could do is set up a small project, write it in both languages and see what you end up preferring. You may also find some restrictions that you can't get around for one of the languages.

In the end it's up to you :)

Edit: that was not an exhaustive list and I tried to be as impartial as I could (but that ends here: I'd go with python :D)

utnapistim
A: 

I believe Python is nice for this sort of tasks because of it's flexibility. Using the numpy/scipy libraries together with a nice plotting lib (chaco or matplotlib for instance) makes the workflow of working with the data and algorithms easy and you can lab around with the code in the live interpreter in an almost matlab-like manner. Change a line of code here, cleanse the data there and watch the whole thing live in a graph window without having to bother with recompilation etc.

Once you settled on the algorithms it is fairly easy to profile the code and move hotspots into C/C++ or Fortran for instance if you are worried about performance.

(you could even write the stuff in Jython and drop down into java for the performance-heavy bits of the code if you really like to be on the JVM platform)

Rickard