skip to Main Content

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



  1. 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

    Login or Signup to reply.
  2. 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!

    Login or Signup to reply.
  3. Never use PHP for AI. Java or C/C++ is the best, but Python for fast development.

    Login or Signup to reply.
  4. 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++.

    Login or Signup to reply.
  5. 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.

    Login or Signup to reply.
  6. 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.

    Login or Signup to reply.
  7. 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)

    Login or Signup to reply.
  8. 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)

    Login or Signup to reply.
  9. AI is not a language or a specific problem like summation or finding an average of some numbers. It’s the intelligence which is going to be developed artificially. And to make a system intelligent especially a computer you can use any language that computer can understand and you are comfortable with (C, Java, Python, C++). A very simple AI example could be tic-tac-toe. This game could be made by using any language you would like to. The important thing is the algorithm that needs to be developed. AI is a vast area and it comprises of many things like Image processing, NLP, Machine learning, Psychology and more. And most importantly one has to be very strong in Mathematics, which is the most important and integral part of softcomputing. So again AI is not a language rather intelligent algorithm based on pure mathematics.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top