热线电话:13121318867

登录
首页大数据时代Python在人工智能中的作用
Python在人工智能中的作用
2018-02-08
收藏


谷歌的AI击败了一位围棋大师,是一种衡量人工智能突然的快速发展的方式,也揭示了这些技术如何发展而来和将来可以如何发展。


人工智能是一种未来性的技术,目前正在致力于研究自己的一套工具。一系列的进展在过去的几年中发生了:无事故驾驶超过300000英里并在三个州合法行驶迎来了自动驾驶的一个里程碑;IBM Waston击败了Jeopardy两届冠军;统计学习技术从对消费者兴趣到以万亿记的图像的复杂数据集进行模式识别。这些发展必然提高了科学家和巨匠们对人工智能的兴趣,这也使得开发者们了解创建人工智能应用的真实本质。开发这些需要注意的第一件事是:



哪一种编程语言适合人工智能?


你所熟练掌握的每一种编程语言都可以是人工智能的开发语言。

人工智能程序可以使用几乎所有的编程语言实现,最常见的有:Lisp,Prolog,C/C++,近来又有Java,最近还有Python.

LISP

像LISP这样的高级语言在人工智能中备受青睐,因为在各高校多年的研究后选择了快速原型而舍弃了快速执行。垃圾收集,动态类型,数据函数,统一的语法,交互式环境和可扩展性等一些特性使得LIST非常适合人工智能编程。

PROLOG

这种语言有着LISP高层和传统优势有效结合,这对AI是非常有用的。它的优势是解决“基于逻辑的问题”。Prolog提供了针对于逻辑相关问题的解决方案,或者说它的解决方案有着简洁的逻辑特征。它的主要缺点(恕我直言)是学起来很难。

C/C++

就像猎豹一样,C/C++主要用于对执行速度要求很高的时候。它主要用于简单程序,统计人工智能,如神经网络就是一个常见的例子。Backpropagation 只用了几页的C/C++代码,但是要求速度,哪怕程序员只能提升一点点速度也是好的。

JAVA

新来者,Java使用了LISP中的几个理念,最明显的是垃圾收集。它的可移植性使它可以适用于任何程序,它还有一套内置类型。Java没有LISP和Prolog高级,又没有C那样快,但如果要求可移植性那它是最好的。

PYTHON

Python是一种用LISP和JAVA编译的语言。按照Norvig文章中对Lips和Python的比较,这两种语言彼此非常相似,仅有一些细小的差别。还有JPthon,提供了访问Java图像用户界面的途径。这是PeterNorvig选择用JPyhton翻译他人工智能书籍中程序的的原因。JPython可以让他使用可移植的GUI演示,和可移植的http/ftp/html库。因此,它非常适合作为人工智能语言的。


在人工智能上使用Python比其他编程语言的好处

优质的文档

平台无关,可以在现在每一个*nix版本上使用

和其他面向对象编程语言比学习更加简单快速

Python有许多图像加强库像Python Imaging Libary,VTK和Maya 3D可视化工具包,Numeric Python, Scientific Python和其他很多可用工具可以于数值和科学应用。

Python的设计非常好,快速,坚固,可移植,可扩展。很明显这些对于人工智能应用来说都是非常重要的因素。

对于科学用途的广泛编程任务都很有用,无论从小的shell脚本还是整个网站应用。

最后,它是开源的。可以得到相同的社区支持。




AI的Python库

总体的AI库

AIMA:Python实现了从Russell到Norvigs的“人工智能:一种现代的方法”的算法

pyDatalog:Python中的逻辑编程引擎

SimpleAI:Python实现在“人工智能:一种现代的方法”这本书中描述过的人工智能的算法。它专注于提供一个易于使用,有良好文档和测试的库。

EasyAI:一个双人AI游戏的python引擎(负极大值,置换表、游戏解决)


机器学习

PyBrain 一个灵活,简单而有效的针对机器学习任务的算法,它是模块化的Python机器学习库。它也提供了多种预定义好的环境来测试和比较你的算法。

PyML 一个用Python写的双边框架,重点研究SVM和其他内核方法。它支持Linux和Mac OS X。

scikit-learn旨在提供简单而强大的解决方案,可以在不同的上下文中重用:机器学习作为科学和工程的一个多功能工具。它是python的一个模块,集成了经典的机器学习的算法,这些算法是和python科学包(numpy,scipy.matplotlib)紧密联系在一起的。

MDP-Toolkit这是一个Python数据处理的框架,可以很容易的进行扩展。它海收集了有监管和没有监管的学习算饭和其他数据处理单元,可以组合成数据处理序列或者更复杂的前馈网络结构。新算法的实现是简单和直观的。可用的算法是在不断的稳定增加的,包括信号处理方法(主成分分析、独立成分分析、慢特征分析),流型学习方法(局部线性嵌入),集中分类,概率方法(因子分析,RBM),数据预处理方法等等。


自然语言和文本处理库

NLTK 开源的Python模块,语言学数据和文档,用来研究和开发自然语言处理和文本分析。有windows,Mac OSX和Linux版本。


案例

做了一个实验,一个使用人工智能和物联网做员工行为分析的软件。该软件通过员工情绪和行为的分心提供了一个有用的反馈给员工,从而提高了管理和工作习惯。

使用Python机器学习库,opencv和haarcascading概念来培训。建立了样品POC来检测通过安置在不同地点的无线摄像头传递回来基础情感像幸福,生气,悲伤,厌恶,怀疑,蔑视,讥讽和惊喜。收集到的数据会集中到云数据库中,甚至整个办公室都可以通过在Android设备或桌面点击一个按钮来取回。

开发者在深入分析脸部情感上复杂点和挖掘更多的细节中取得进步。在深入学习算法和机器学习的帮助下,可以帮助分析员工个人绩效和适当的员工/团队反馈。


结论

python因为提供像 scikit-learn的好的框架,在人工智能方面扮演了一个重要的角色:Python中的机器学习,实现了这一领域中大多的需求。D3.js JS中数据驱动文档时可视化最强大和易于使用的工具之一。处理框架,它的快速原型制造使得它成为一门不可忽视的重要语言。AI需要大量的研究,因此没有必要要求一个500KB的Java样板代码去测试新的假说。python中几乎每一个想法都可以迅速通过20-30行代码来实现(JS和LISP也是一样)。因此,它对于人工智能是一门非常有用的语言。




【英文原版】


Role of Python in Artificial Intelligence


Google’s AI Beating a Go Grandmaster is a way of judging the suddenly rapid progress of artificial intelligence that may show how far these technologies have come—and how far they may go.

Artificial intelligence is a futuristic technology that is working on its set of tools at present. A slew of advances has been observed in last few years: Self-driving cars that have achieved a milestone by logging over 300,000 accident-free miles and becoming officially legal in three states; IBM Watson which beat two champions of Jeopardy!; and statistical learning techniques are conducting pattern recognition on complex data sets from consumer interests to trillions of images. These developments certainly raised the number of scientists or giants taking interest in AI, which has made it essential for developers to understand the ground realities of building AI applications. The first thing that strikes developers is,


Which programming language is good for AI?

Every programming language is a AI language if you are adept in it!

AI programs are written in almost all the programming languages, the most common are: Lisp, Prolog, C/C++, recently Java, and even more recently, Python.

LISP

High-level languages like LISP are favored in AI because after many years of research in various universities fast prototyping was chosen over fast execution. Garbage collection, dynamic typing, functions as data, uniform syntax, interactive environment, and extensibility are some of its feature that makes the language suitable for AI programming.

PROLOG

This language comes with an effective combination of the high-level and traditional advantages of Lisp with a built-in unifier, which is particularly useful in AI. It’s strength is ‘logic based problems’. Prolog gives good solutions for problems in which logic is intimately involved, or whose solutions have a succinct logical characterization. Its major drawback (IMHO) is that it’s hard to learn.

C/C++

Cheetah of the bunch, C/C++ is mostly used when the speed of execution is most important. It is used mostly when the program is simple, statistical AI techniques such as neural networks are common examples of this. Backpropagation is only a couple of pages of C/C++ code, and needs every ounce of speed that the programmer can muster.

JAVA

The newcomer, Java uses several ideas from Lisp, most notably garbage collection. Its portability makes it desirable for just about any application, and it has a decent set of built in types. Java is still not as high-level as Lisp or Prolog, and not as fast as C, making it best when portability is paramount.

PYTHON

Python is a language with the best compilation of Lisp and Java both.According to Norvig is his text comparing Lisp to Python, these two languages are very similar to each other with some minor differences. There also exists JPython, giving access to the Java GUIs. This is the reason behind Peter Norvig choosing JPython to translate his programs from his AI book. As JPython allowed him to have portable GUI demos, and portable http/ftp/html libraries. Therefore, it is very good to use as AI language.


Benefits of Using Python over the Other Programming Languages for AI

1.Good quality documentation.

2.Platform agnostic, and present in virtually every *nix distribution.

3.Easy and fast to learn in comparison to any other OOP language.

4.Python has many image intensive libraries like Python Imaging Library, VTK and Maya 3D Visualization Toolkits, Numeric Python, Scientific Python and many other tools available for numeric and scientific applications.

5.Python is very well designed, fast, robust, portable, and scalable. These are evidently the most important factors for AI applications.

6.Useful for a really broad range of programming tasks from little shell scripts to enterprise web applications to scientific uses.

7.Last but not the least, it is Open Source! Good community support available for the same.



Python Libraries for AI

Libraries for General AI

1.AIMA – Python implementation of algorithms from Russell and Norvig’s ‘Artificial Intelligence: A Modern Approach’

2.pyDatalog – Logic Programming engine in Python

3.SimpleAI – Python implementation of many of the artificial intelligence algorithms described on the book “Artificial Intelligence, a Modern Approach”. It focuses on providing an easy to use, well documented and tested library.

4.EasyAI – Simple Python engine for two-players games with AI (Negamax, transposition tables, game solving).


Libraries for ML

1.PyBrain – It is a flexible, simple yet effective algorithms for ML tasks, it is a modular Machine Learning Library for Python. It also provides a variety of predefined environments to test and compare your algorithms.

2.PyML – A bilateral framework written in Python that focuses on SVMs and other kernel methods. It is supported on Linux and Mac OS X.

3.scikit-learn – It aims to provide easy and powerful solutions reusable in various contexts: machine-learning as a versatile tool for science and engineering. It is a Python module that integrates the classic classic machine learning algorithms in the tightly-knit world of scientific Python packages (numpy, scipy, matplotlib).

4.MDP-Toolkit – It is a Python data processing framework that can be easily expanded, it also has a collection of supervised and unsupervised learning algorithms and other data processing units that can be combined into data processing sequences and more complex feed-forward network architectures. The implementation of new algorithms is easy and intuitive. The base of available algorithms is steadily increasing and includes signal processing methods (Principal Component Analysis, Independent Component Analysis, Slow Feature Analysis), manifold learning methods ([Hessian] Locally Linear Embedding), several classifiers, probabilistic methods (Factor Analysis, RBM), data pre-processing methods, and many others.


Libraries for Natural Language & Text Processing

NLTK – Open source Python modules, linguistic data and documentation for research and development in natural language processing and text analytics, with distributions for Windows, Mac OSX and Linux.

Case Study

An experiment to bring AI to use with Internet of Things was done to make a software for employee behavioral analytics. The software provides useful feedback to the employees through employee emotions and behaviour analysis, thus enhancing positive changes in management and work habits.

Using python machine learning libraries, opencv and haarcascading concepts for application training, a sample POC was built to detect basic emotions like happiness, anger, sadness, disgust, suspicion, contempt, sarcasm and surprise through wireless cameras attached at various bay points. The data collected was feeded to a centralized cloud database where daily emotional quotient within the bay, or even the entire office could be retrieved at the click of a button either through android device or desktop.

Developers are making gradual progress in analyzing further complex points on facial emotions and mine more details with the help of deep learning algorithms and machine learning which can help analyze individual employee performance and help in proper employee/team feedback.


Conclusion

Python plays an important role in Artificial Intelligence by providing it with good frameworks like scikit-learn: machine learning in Python, which fulfills almost every need in this field and D3.js – Data-Driven Documents in JS, which is one of the most powerful and easy-to-use tools for visualization. Other than frameworks, it’s fast prototyping makes it an important language not to be ignored. AI needs a lot of research and hence it is necessary not to require a 500 KB boilerplate code in Java to test a new hypothesis, which will never finish the project. In Python almost every idea can be quickly validated through 20-30 lines of code (same for JS with libs). Therefore, it is a pretty useful language for the sake of AI.

数据分析咨询请扫描二维码

最新资讯
更多
客服在线
立即咨询