java 我应该在 Web 项目中使用哪种语言进行人工智能
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/3050450/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which language should I use for Artificial intelligence on web projects
提问by
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.
我只知道PHP/mysq/JS,PHP中AI的东西例子不多。
There are some books on AI on internet but they use Java , Python.
互联网上有一些关于 AI 的书籍,但它们使用 Java、Python。
Now I have to apply AI techniques on web application.
现在我必须将 AI 技术应用于 Web 应用程序。
Which language should i choose java or python.
我应该选择 java 还是 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
我在互联网上搜索到我可以在我的 php 中调用 java 类,这样可以提供帮助,因为我非常擅长 php
I have also seen that python can also be used with php as well
我还看到 python 也可以与 php 一起使用
So which way should I go and roughly how much it will take me to learn java
那么我应该走哪条路,大概需要多少时间来学习 Java
I have done java basics but that was 6 years ago
我已经完成了 Java 基础,但那是 6 年前的事了
采纳答案by Joel Hoff
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.
在您提到的语言中,您可能会发现 Java 中最有用的工具,尤其是机器学习资源。一个很好的例子是WEKA,它是一种用 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.
我会先寻找工具,然后在考虑工具选项的情况下决定语言。
回答by Nikita Rybak
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.
说到学习时间,这个问题恐怕没有明确的答案。我认为最好的方法是查看 java 和 python 中的代码示例,看看哪个看起来“更好”、更容易、更熟悉。
Good luck!
祝你好运!
回答by Upul Bandara
You can use either Java or Python. A lot of resources are available for both languages.
您可以使用 Java 或 Python。两种语言都有大量资源可用。
I think following books might suit for your purpose.
我认为以下书籍可能适合您的目的。
Programming collective intelligence: building smart web 2.0
回答by utnapistim
Which language should i choose java or python.
我应该选择 java 还是 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.
java 被更广泛地使用(大概更成熟的代码“在那里”可以查看 - 但我还没有测试过)
python 的效率更高(在 python 中编写比在 java 中编写得更快),并且从学习语言到编写所需的代码,python 比 java 花费的时间更少
python是多范式的,java是(几乎)严格的OOP
java是编译的(而python是脚本化的);这意味着 java 在编译时会发现您的错误;执行时的python - 这可能会产生很大的不同,具体取决于您的开发风格/实践
java比python定义更严格,也更冗长。在 java 中,您必须将合同正式化,而在 python 中,您使用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)
编辑:这不是一个详尽的清单,我尽量保持公正(但到此结束:我会选择 python :D)
回答by Coltin
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.
您可以使用任何您喜欢的语言,只要它所在的服务器支持它。您可以使用 HTML/JS 作为用户界面,并使用 AJAX 请求从服务器请求结果。
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++.
回答这些请求的将是您的 AI 代码,它可以是您想要的任何东西。PHP 使得响应 AJAX 请求变得非常简单。由于您已经熟悉它,我建议您这样做,但如果您的 AI 非常复杂,您可能想要使用更高效的东西,例如 C/C++。
回答by Rickard
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.
我相信 Python 非常适合此类任务,因为它具有灵活性。将 numpy/scipy 库与一个漂亮的绘图库(例如 chaco 或 matplotlib)一起使用,可以使处理数据和算法的工作流程变得简单,您可以以几乎类似于 matlab 的方式在实时解释器中试验代码。在这里更改一行代码,清理那里的数据,然后在图形窗口中实时查看整个过程,而无需费心重新编译等。
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.
一旦确定了算法,就很容易分析代码并将热点移到 C/C++ 或 Fortran 中,例如,如果您担心性能。
(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)
(如果您真的喜欢在 JVM 平台上工作,您甚至可以在 Jython 中编写这些内容,然后将其放入 Java 中以获得代码的性能高位)
回答by Anupam
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.
AI 不是一种语言或特定问题,例如求和或求某些数字的平均值。这是将要人工开发的智能。并且要使系统变得智能,尤其是计算机,您可以使用计算机可以理解并且熟悉的任何语言(C、Java、Python、C++)。一个非常简单的 AI 示例可能是井字游戏。这个游戏可以用任何你喜欢的语言来制作。重要的是需要开发的算法。AI 是一个广阔的领域,它包含许多内容,例如图像处理、NLP、机器学习、心理学等。最重要的是,数学必须非常强,这是软计算最重要和不可或缺的部分。因此,AI 又不是一种语言,而是基于纯数学的智能算法。
回答by DavidG
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.
考虑到努力和意愿,几乎任何语言都可以用来编写几乎任何东西。但是 Python 具有更多的函数式编程结构,这在您编写 AI 代码时可能更有用。
回答by HKVN
Never use PHP for AI. Java or C/C++ is the best, but Python for fast development.
切勿将 PHP 用于 AI。Java 或 C/C++ 是最好的,但 Python 用于快速开发。

