See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/366578422 The Use of Python in the field of Artifical Intelligence Conference Paper · October 2020 CITATIONS 4 READS 937 4 authors, including: Sinisa Mihajlovic University of Novi Sad 24 PUBLICATIONS   14 CITATIONS    SEE PROFILE Dragan Vojo Ivetic University of Novi Sad 53 PUBLICATIONS   201 CITATIONS    SEE PROFILE Ivana Berković University of Novi Sad 14 PUBLICATIONS   12 CITATIONS    SEE PROFILE All content following this page was uploaded by Sinisa Mihajlovic on 25 December 2022. The user has requested enhancement of the downloaded file. The Use of Python in the field of Artifical Intelligence S. Mihajlović*, A. Kupusinac**, D. Ivetić**, I. Berković* * Technical Faculty “Mihajlo Pupin”, Zrenjanin, Republic of Serbia ** Faculty of Technical Sciences, Novi Sad, Republic of Serbia mihajlovicsinisa25@gmail.com, sasak@uns.ac.rs, ivetic@uns.ac.rs, ivana.berkovic62@gmail.com Abstract – This paper presents the role of artificial intelligence and Python programming language. Examples of Python application in AI fields are described. The advantages and disadvantages of the Python programming languages are listed. Because there are a large number of programming languages used for programming in AI, a comparison of selected AI programming languages was performed. I. INTRODUCTION College students spend a lot of time learning programming languages, but they are still not familiar with all the programming languages that exist. One of the most popular programing languages is Python. Python has a wide application, and as such is often taught in various faculties through subjects. In the late 1980s, Guido Van Rossum created Python, which is a powerful, procedural, objectoriented, and functional programming language. The language is used in different application domains. These include software development, web development, Desktop GUI development, education, and scientific applications. It thus encompasses all aspects of development and has gained popularity thanks to its simplicity and robustness. Python can be easily learned and understood. Removing the brackets make the code short. Some tasks in Python are quite simple, while learning advanced functions is a bit more complex. The project written in Python is easy to understand. Python code is concise, efficient, understandable, and manageable [1]. Artificial intelligence (AI) is widespread field and is one of the most common subjects in colleges, where the goal is to introduce students to AI. John McCarthy is considered the father of artificial intelligence, and he believes that artificial intelligence is the science and engineering of making intelligent machines, especially intelligent computer programs. AI is a way to make a computer, a computer-controlled robot, or software that thinks intelligently, in a similar way that intelligent people do. By harnessing the power of computer systems, it has led man to question whether a machine can think and behave like humans. The development of AI is intended to create similar intelligence in machines found in humans [2]. AI is a way to make machines think and behave intelligently. Machines can be controlled by the software contained in them, which means that AI has to do with software programs that control machines. AI is a science that finds theories and methodologies that will help machines understand the world and react to situations in the same ways as humans. AI is used in many different forms around the world. Scientists want to make machines feel, judge thoughts and act, as well as be rational. It is believed that by understanding how the human brain works, one can achieve results in the field of AI. A machine can be built if it imitates the way the human brain learns, thinks, and acts. All this can be used as a platform for the development of intelligent systems capable of learning [3]. Artificial intelligence is considered a trend technology of the future. There are several applications that are made on it. It is very interesting for companies and researchers and raises the question of which programming language can be used to develop AI applications. There are various programming languages such as Lisp, Prolog, C++, Java, Python, which can be used to develop AI applications. Among them, the Python programming language is gaining in popularity, and some of the reasons are that Python includes very little coding and simple syntax among other programming languages that can be developed for AI application development. Testing for this reason can be easier and can focus more on programming itself. The main advantage of using Python for AI is that it comes with built-in libraries. Python has libraries for almost all types of AI projects. For example, NumPy, SciPy, matplotlib, nltk, SimpleAI are some of the important embedded Python libraries [2]. II. RELATED WORK Artificial intelligence (AI) as a subfield of computer science focuses on designing computer programs and machines capable of performing task in which people are naturally good, such as understanding natural language, understanding speech, and recognizing images [4]. AI strives to create machines are intelligent as human beings. There are many reasons to study AI. Nowadays, it works with a huge amount of data, which the human brain cannot keep track. That is why it is necessary to automate things. To do automation, it is necessary to study AI, because it can learn from data and can perform tasks with precision, accuracy and without tiredness. It is necessary for the system to teach itself because the data itself changes, and the knowledge that results from such data must constantly updated. That is why AI is used, because an AI enabled system can teach itself. With the help of neural networks, AI can analyze data more deeply, as well as achieve tremendous accuracy. AI can think and respond to the situations which are based on the conditions in real time. For systems that use self-learning algorithms, the data is intellectual property. AI is needed to be indexed and organized in a way that always gives the best results [5]. Intelligence is the ability of a system to calculate, reason, perceive relationships and analogies, to learn from experience, store and retrieve information from memory, solve problems, understand complex ideas, use natural language fluently, classify, generalize, and adapt new situations. According to American development psychologist Howard Gardner, intelligence comes in many forms: linguistic intelligence, musical intelligence, logicalmathematical intelligence, spatial intelligence, bodily-kinesthetic intelligence, intra-personal intelligence, interpersonal intelligence. A machine or artificial intelligence system is considered intelligent if it possesses at least one of the intelligences. Intelligence is intangible and consists of reasoning, learning, problem solving, perception, linguistic intelligence [2]. AI is a large field of study and helps find solutions to real-world problems. Fields of study in AI are machine learning, logic, searching, artificial neural networks, genetic algorithm, knowledge representation. AI is applied in gaming, natural language processing, expert systems, vision systems, speech recognition, handwriting recognition, intelligent robots [5]. Python is an example of a language that does everything right within the domain of things for which it is designed. What sets Python apart is that the application can be written on one platform and can be used on other platforms. Python code is readable and has a concise syntax that allows applications to be written using fewer lines of code than other programming languages. Python supports functional, imperative, object-oriented, and procedural coding styles. Python provided for educational and other purposes for which other programming languages may fail [6]. Python is particularly attractive for workloads in data science, machine learning, and scientific computing. NumPy is the basis of the Python stack for machine learning. It enables efficient operations on data structures often used in machine learning, vectors, matrices, and tensors. The main data structure of NumPy is a multidimensional array [7]. NumPy is a multidimensional array library with basic linear algebra routines, while the SciPy library adorns NumPy arrays with important primitives, numerical optimizers, and signal processing to statistics and scarce linear algebra. SciPy is used in almost half of machine learning projects. The Pandas library is a format for presenting tabular data in Python for extracting, transforming, loading context, and analyzing data [4]. TensorFlow is a software library or framework, designed by the Google team to apply machine learning and deep learning concepts in the easiest way. It combines computational algebra optimization techniques to easily compute many mathematical expressions. TensorFlow contains a function that defines, optimizes, and computes mathematical expressions using multidimensional arrays called tensors. Includes deep neural network software and machine learning techniques. Includes a highly scalable computing feature with different data sets. TensorFlow uses GPU computing, automating management. It includes a unique function of optimizing the same memory and data used. TensorFlow is well documented and includes many libraries for machine learning. It offers several important functionalities and methods for the same. TensorFlow is also called a "Google" product. It includes various machine learning and deep learning algorithms. TensorFlow can train and run deep neural networks to manually classify numbers, recognize images, embed words, and create different sequence models [8]. Scikit-learn is a Python module that integrates a wide range of state-of-the-art machine learning algorithms for supervised and unsupervised mediumsized problems. It focuses on bringing machine learning closer to non-specialists who use high-level general-purpose language. Emphasis is placed on ease of use, performance, documentation, and consistency of the API. It has minimal dependencies and is distributed under a simplified BSD license, encouraging use in academic and commercial environments [9]. Theano is a Python library and compilation optimizer for manipulating and processing mathematical expressions, which include multidimensional arrays. Features Theano are tight integration with NumPy, transparent use of GPU, efficient symbolic differentiation, optimization of speed and stability, dynamic C code generation and extensive unique testing and self-checking [10]. Keras is a deep learning API written in Python, launched at the top of the TensorFlow machine learning platform. Allows for quick experimentation. Keras is an acceptable, highly productive interface for solving machine learning problems with a focus on modern deep learning. Provides basic abstractions and building blocks for the development and delivery of high-repetition machine learning solutions. Keras can run on TPU or on large clusters of GPUs, Keras models can be performed to work in a browser or on a mobile device [11]. Natural Language Toolkit (NLTK) is a platform for building a Python program for working with human language data. It provides easy-to-use interfaces and lexical resources such as WordNet, along with a package of word processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning. NLTK is suitable for linguists, engineers, students, teachers, researchers, and industry users [12]. III. ADVANTAGES AND DISADVANTAGES OF PYTHON Python stood out and became one of the most popular programming languages. Python includes very little coding and simple syntax, unlike programming languages that can be used to develop AI applications. Testing can be easier, and the focus can be on programming itself. Python comes with build-in libraries used for AI. Important characteristics of Python: • Support functional and structured programming methods, as well as OOP. • It can be used as a scripting language or it can be compiled into bytecode to build large applications. • Provides high-level dynamic data types and supports dynamic type checking. • Support automatic garbage collection. • It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java [2]. Like any programming language, python has its advantages and disadvantages, which are written below. A. Advantages of Python Python is a programming language that has English-like syntax. It makes it easier to write, read and understand code. Python is a very productive language, because due to its simplicity, the focus is on solving problems. Python is an interpreted language which means it is executed directly code by line. In the event of any error, execution is stopped and the error that occurred is reported. Python shows only one error, even if there are multiple errors. This makes it easier to troubleshoot. Python does not know the type of variable until the code is run. When executed, it automatically assigns a data type. The programmer does not have to worry about declaring variables and their data types. Python comes under an open source license approved by OSI, which makes it free to use and distribute. The source code can be downloaded, modified, and distributed as own version of Python. Python’s standard library is huge, and there are almost all functions for solving various tasks. Python package manager (pip) facilitates the import of other packages from the Python package index (PyPi). Python code can run on different platforms [13]. B. Disadvantages of Python Regular code execution often leads to slow execution. The dynamic nature of Python is responsible for Python’s low speed because it must do extra work while executing code. Python programming language uses a large amount of memory. It is considered a disadvantage when creating applications when it is necessary to perform memory optimization. Python is generally used in server-side programming. Python is not used on client-side or mobile applications because it is not memory efficient and has poor processing power compared to other languages. Communication with the database is not Python's strength. The Python database access layer is primitive and underdeveloped compared to technologies such as JDBC and ODBC. Python is a dynamically typed language, so the data type of a variable can be changed at any time. A variable containing an integer can contain a string in the future, which can lead to execution errors. Therefore, it is necessary to do a thorough testing of applications [14]. IV. COMPARISON OF SELECTED AI PROGRAMMING LANGUAGES There are various languages for writing AI, but there is no perfect programming language that would stand out as the best programming language used in artificial intelligence. The development process depends on the desired functionality of the AI application being developed. Based on the functionality of the AI application, a coding programming language is used. The languages commonly used for artificial intelligence projects are compared to highlight advantages and disadvantages. Java, Python, Lisp, Prolog and C++ are the main AI programming languages used for artificial intelligence and that meet different needs in the development and design of different software. Python is one of the favorite programming languages in AI development among developers because of its syntactic simplicity and versatility. Python is used for machine learning for developers because it is less complex compared to C++ and Java. Python is a portable language because it is used on platforms including Linux, Windows, Mac OS, and UNIX. It is likable because of its features such as interactive, interpreted, modular, dynamic, portable, and high level which make it more unique than Java. Python is a multi-paradigm program that supports object-oriented, procedural, and functional programming styles. Python supports neural networks and the development of NLP solutions thanks to its simple library of functions and more ideal structure. Supports testing of algorithms without the need for their application. Python is fast in development compared to Java and C++. Developers using Python have difficulty adapting to a completely different syntax when they need to use a different language for AI programming. Unlike C++ and Java, Python works with the help of an interpreter which makes compilation and execution slower in AI development. Not suitable for mobile computing [15]. Python programs run slower than Java programs, but they also take much less time to develop. Python programs are usually 3-5 times shorter than equivalent Java programs. This difference is attributed to Python's built-in high-level data types and its dynamic typing. For example, a Python programmer does not waste time declaring argument types or variables. The powerful Python polymorphic list and dictionary type, for which rich syntactic support is built directly into the language, find use in almost every Python program. Because of the run-time typing, Python's run time must work harder than Java's. For example, when evaluating the expression, a + b, it must examine objects a and b to find their type, which is not known at compile time. The appropriate addition operation is then called, which can be overloaded with a user-defined method. Java, on the other hand, can perform integer addition, but requires declarations of variables for a and b, and does not allow overloading for the + operator for instances of user-defined classes. For these reasons, Python is much better suited as a "glue" language, while Java is better characterized as a low-level implementation language [16]. C++ is the fastest computer language. Its speed is important for developers who value time the most. It enables fast execution and has less response time and is therefore applied in search engines and computer game development. C++ allows extensive use of algorithms and is efficient in the use of statistical AI techniques. C++ supports the reuse of programs in development due to inheritance and data hiding, which is efficient in saving time and costs. C++ is suitable for machine learning and neural networks. It is good for finding solutions to complex AI problems. It is rich in library functions and a collection of software tools. C++ is a multiparadigm program that supports object-oriented principles that are useful in achieving organized data. C++ is bad at multitasking. C++ is only suitable for the application of the kernel or database of certain systems or algorithms. The bottom-up approach is extremely complex and makes it difficult for novice developers to write AI programs [15]. What applies to Java applies to C++ even more. The Python code is often 5-10 times shorter than the equivalent C++ code. Anecdotal evidence suggests that a single Python programmer can complete in two months what two C++ developers cannot complete in a year [16]. Java is a multi-paradigm programming language that follows object-oriented principles and the Once Written Read/Run Anywhere (WORA) principle. It is an AI programming language that can run on any platform that supports it without the need to recompile. Most of the syntax is derived from C and C++. Java is not only appropriate for NLP and search algorithms but also for neural networks. Unlike C++, Java is easy to use and even debug. It has an automatic memory manager that facilitates the work of programmers. Java is slower than C++, has lower execution speed and longer response time. Java is portable, but older platforms would require software and hardware changes [15]. Lisp is the language used to develop AI. It is the second oldest programming language after Fortran. Lisp has evolved into a powerful and dynamic coding language. Some consider Lisp to be the best AI programming language because of the liking for freedom it offers developers. Lisp is used in AI because of its flexibility for fast prototyping and experimentation. Lisp has a unique macro system that facilitates the research and application of different levels of intellectual intelligence. Lisp is suitable for inductive logic and machine learning projects. Lisp supports the compiler instead of the interpreter and is therefore fast and efficient in encoding. An automatic memory manager was invented for Lisp, which collects garbage. Lisp offers specific control over systems resulting in its maximum use. Few programmers are familiar with Lisp programming. Being a vintage programming language artificial intelligence, Lisp requires configuration of new software and hardware to accommodate it use [15]. Lisp is close to Python in its dynamic semantics, but so different in its approach to syntax. Python has introspective possibilities like Lisp. Python programs can construct and execute program fragments on the fly [16]. Prolog is also one of the oldest programming languages and is therefore suitable for AI development. Like Lisp it is also the primary language for AI. It has mechanisms that facilitate flexible frameworks that developers enjoy working with. It is a declarative language based on rules because it contains facts and rules that dictate its language of coding artificial intelligence. Prolog supports basic mechanisms such as pattern matching, tree-based data structuring, and automatic backtracking essential for AI programming. Prolog has a built-in list processing that is necessary to represent tree-based data structures. It is effective for rapidly prototyping frequently published AI programs. It allows the creation of a database at the same time as running the program [15]. V. CONCLUSION Artificial intelligence (AI) is a widespread are known worldwide. As such, it is often taught through courses at universities. AI plays a major role in advancing technology as well as facilitating various jobs. AI strives to create machines that will be able to replace people in various jobs, achieving accuracy and precision. Huge results have been achieved in the field of AI, but there is still a tendency towards something bigger and better. Various programming languages and various researchers have contributed to this. Python is used in various fields of AI. Python is one of the favorite programming languages among AI developers because of its syntactic simplicity and versatility. Python is a multi-paradigm program that supports object-oriented, procedural, and functional programming styles. There are many programming languages used for programming in AI. People constantly wondering which programming language is best for programming in AI, and there is no answer to that. Each programming language has its advantages and disadvantages. This paper presents a comparison of programming languages that are most popular among AI programming developers. The list of programming languages consists of Python, C++, Java, Lisp and Prolog. Depending on the functionality of the AI application, a programming language is used. By selecting the appropriate language, the appropriate result is achieved. REFERENCES [1] H. Bhasin, Python Basics A Self-Teaching Introduction, Mercury Learning and Information, 2019. [2] Artifical Intelligence with Python, Tutorials Point (I), Pvt. Ltd., 2016. [3] P. Joshi, Artificial Intelligence with Python, Packt Publishing, January 2017. [4] S. Raschka, J. Patterson, C. Nolet, Machine Learning in Python: Main Developments and Technology Trends in Data Science, Machine Learning, and Artificial Intelligence, Information, April 2020. [5] W. Ertel, Introduction to Artificial Intelligence, Second Edition, Springer International Publishing AG, 2017. [6] J. P. Muller, Beginning Programming with Python for Dummies, 2nd Edition, John Wiley & Sons, Inc., 2018. [7] C. Albon, Machine Learning with Python Cookbook, O’Reilly Media, Inc., 2018. [8] TensorFlow, Tutorials Point (I), Pvt. Ltd., 2018. [9] F. Pedregosa et al., Scikit-learn: Machine Learning in Python, Journal of Machine Learning Research 12, pp. 2825-2830, 2011. [10] Theano. URL: http://deeplearning.net/software/theano/# (accessed 28.09.2019.) [11] Keras. URL: https://keras.io/about/ (accessed 28.09.2019.) [12] NLTK. URL: https://www.nltk.org/ (accessed 28.09.2019.) [13] TechVidvan. URL: https://techvidvan.com/tutorials/pythonadvantages-and-disadvantages/ (accessed 28.09.2019.) [14] edureka!. URL: https://www.edureka.co/blog/advantages-anddisadvantages-of-python/#Disadvantagesofpython (accessed 28.09.2019.) [15] Existek. URL: https://existek.com/blog/ai-programming-and-aiprogramming-languages/ (accessed 28.09.2019.) [16] Python. URL: https://www.python.org/doc/essays/comparisons/ (accessed 28.09.2019.) View publication stats