BEST PROGRAMMING LANGUAGE FOR A.I.
Dr. Mohd Shamrie Sainin
Language Engineering and Application Development Research Group
Overview
Computer Science
Artificial Intelligence
Symbolic Learning Computer
Vision Robotics
Machine Learning
Statistical Learning
Speech NLP
Reinforcement
Learning Deep Learning
CNN Computer
Vision Object
RNN
Background – AI Definition
▪ Definition 1:
▪ It is a branch of computer science by which we can create
intelligent machines which can behave like a human, think like humans, and able to make decisions.
▪ Definition 2:
▪ The theory and development of computer systems able to
perform tasks normally requiring human intelligence, such as visual perception, speech recognition, decision-making, and translation between languages.
Background: Four views of AI
▪ The science of making machines that:
▪ A system is rational if it does the “right thing,” given what it knows
Thinking Humanly Thinking Rationally Acting Humanly Acting Rationally
Acting Humanly – Turing Test
▪ Turing Test (1950) "Computing machinery and intelligence":
▪ "Can machines think?" → "Can machines behave intelligently?"
▪ The computer passes the test if 1/3 of the human interrogator
cannot tell whether the written responses come from a person or not.
AI
Acting Humanly – Turing Test (or Searle Room)
▪ Means – trying to understand and model how human mind works
▪ Turing’s test suggested major components of AI:
▪ Knowledge Representation, Automated Reasoning, Natural Language Processing, Machine Learning
▪ Cognitive science focuses on how people think
▪ e.g., a cognitive tutor for mathematics
Thinking Rationally
▪ Uses symbolic logic to capture the laws of rational thought as symbols that can be manipulated.
▪ Reasoning involves
▪ manipulating the symbols according to well-defined rules, kind of like algebra.
▪ The result is an idealized model of human reasoning (how human think and reason in ideal world)
▪ Example:
▪ Socrates is a man; all men are mortal; therefore, Socrates is mortal
Background: Acting Rationally
▪ Rational behavior: doing the right thing
▪ The right thing:
▪ that which is expected to maximize goal achievement, given the available information
▪ Doesn't necessarily involve thinking
▪ e.g., blinking reflex – but thinking should be in the service of rational action
▪ Applied in: Rational Agent
Development of AI
Early days
1943 McCulloch & Pitts: Boolean circuit model of brain
1950 Turing's "Computing Machinery and Intelligence“
The birth of artificial intelligence
1956 Dartmouth meeting: "Artificial Intelligence" adopted
Development of AI
Excitement and expectations
1952—69 Look, Ma, no hands! Era
1950s Early AI programs, including Samuel's checkers program
(http://www.fierz.ch/samuel.htm), Newell & Simon’s LogicTheorist, Gelernter's Geometry Engine
1965 Robinson's complete algorithm for logical reasoning
Development of AI
The rest…
1969—79 Early development of knowledge-based systems
1980-- AI becomes an industry
1986-- Neural networks return to popularity
1987-- AI becomes a science
1995-- The emergence of intelligent agents
2001-- The availability of very large data sets
Now What?
▪ The AI and its possibilities are extremely broad considering on what we have today
▪ But before that
▪ How are AI applications defined?
▪ How are AI applications designed?
▪ How are AI applications developed/programmed?
▪ Then:
▪ What languages to develop AI applications?
Core fundamentals in AI
▪ Fundamentals
▪ Knowledge representation
▪ Reasoning, inferencing
▪ Problem solving methods – space, searching
▪ Perception - interpret, acquire, select, and then organize the sensory information
▪ Applied (e.g.)
▪ Learning
▪ Planning and scheduling
▪ Manipulating objects (e.g., moving object)
Important Components to Intelligent Systems
▪ Representation
▪ Mapping the environment of the agent into symbols that can be manipulated, e.g., representation of board (tic- tac-toe, etc.) into symbols
▪ Reasoning
▪ Manipulate the symbols to make decisions, e.g., how to decide the move in tic-tac-toe.
Methods involved
▪ Knowledge representation & engineering
▪ Representation of knowledge that computer can use
▪ Methods: semantic networks, propositional logic, first order logic, rules, graph, game trees
▪ Reasoning & Inference
▪ The process of using facts, knowledge and problem-solving strategies to produce conclusions to solve problems and
make decisions.
▪ E.g., deduction, induction, modus ponens, resolution, etc.
▪ Searching
▪ e.g., DFS, BFS, A*, etc.
So, what language to develop AI Systems?
▪ Traditional AI Programming Languages
▪ Modern AI Languages
▪ AI Platform
Traditional AI Programming Languages
▪ Approach used to traditional artificial intelligence problem – which more on symbolic AI
▪ Example of programming languages (1950-2008)
▪ ILP (information processing language), 1956
▪ LISP, 1958
▪ Smalltalk, 1972
▪ PROLOG, 1972
▪ C/C++, 1972/1985
▪ Java, 1995
▪ AIML (artificial intelligence markup language), 2001
Programming in Logic (PROLOG)
1970 Alain Colmerauer introduce language for interpreting natural language at University of Marseille
1977 David Warren from Universiti of Edinburgh introduce Prolog- 10 (Edinburgh Prolog)
1982 Japan involvement in design production of fifth generation computer using Prolog as fundamental system language.
Declarative vs. Procedural
Declarative statement is about what is true.
•relationship.
If we have fact:
like(bob, chocolate).
Then when a query:
Does bob like chocolate?
Then the answer is yes.
Procedural statement is about how to do
something.
•Explain how output is generated (step).
Two ways to evaluate Prolog program:
Traditional programming languages are using prosedural because the programmer who tell how to solve the problem.
In Logic programming, programmer is only giving the problem and related relationship among the facts and Prolog will solve the problem. Although
Syntax
▪ Differ from other languages from:
▪ Programming about object and relationship among them.
▪ Programming based on symbolic.
▪ Using predicate logic representation (clause form).
▪ Does not have to initialize variable type.
Syntax
▪ Example 1
▪ Normal: ali eats ketupat.
▪ Logic: eats(ali,ketupat).
▪ Prolog: eats(ali,ketupat).
▪ Example 2
▪ Normal: everybody like to eat fried chicken.
▪ logik: X like_eat(X, fried_chicken)
▪ Prolog: like_eat(X,fried_chicken).
Syntax
▪ Example
▪ Normal: All human are mortal
▪ Logic : X (human(X) → mortal(X))
▪ Prolog: mortal(X) :- human(X).
▪ Meaning: mortal(X) human(X).
Syntax (Java vs Prolog)
Java (Hello.java)
class Hello {
public static void main(String args[]) { int i=1;
i++;
System.out.println(“Nilai i :” + i), }
}
C:\> java Hello Nilai i = 2
Prolog (Hello.pl)
main :-
nl,
I is 1+1,
write('Nilai i': I), nl.
?-consult hello.pl
?-main.
Nilai i : 2 yes
Prolog Versions
▪ Arity Prolog
▪ ALS Prolog
▪ Quintus Prolog
▪ SWI Prolog
▪ LPA Prolog
• AMZI Prolog
• Edinburgh Prolog
• Visual Prolog
• Strawberry Prolog
• Etc..
LPA Prolog
SWI (Old Version)
Strawberry Prolog
SWI Prolog (Online compiler)
Sample Application with PROLOG
PROLOG for AI - Findings
▪ Prolog –
▪ Best for declarative, knowledge-based application, symbolic, pattern matching
▪ Mostly used to teach concept of AI in the universities
▪ Not much being used in industry
Prolog Compilers
▪ LPA Prolog
▪ Graphical IDE, various support for Expert System, Data Mining, CBR, Fuzzy Logic, Web - Expensive
▪ SWI Prolog
▪ Command Line, support and updates (as of 2020)
▪ Strawberry Prolog
▪ Light Edition (Free), Middle and Professional (License)
▪ IDE, GUI
▪ Online compiler – just for testing and teaching, e.g.,
▪ SWISH
▪ Jdoodle - Prolog
2003 – Student Project (PROLOG) – Expert System
▪ Expert System Shell Prototype in Prolog
▪ Expert System Shell as an Education Tool
MSc IKBS Student (2003)
Other projects using different languages
▪ Genetic Algorithm Document Keyword Optimization for searching (Java)
▪ 2003 - Student Project (Visual Basic) – Apriori
▪ 2003 – Machine Learning Educational Tool – Java
▪ 2003 – Student Project – Online Product Recommendation (Cold Fusion)
▪ 2003 – Image Recognition – Java
▪ 2005 – Document Classifier with Naïve Bayes – Java
▪ 2009 – Leaf Image Recognition - Java
Genetic Algorithm Document Keyword
Optimization for searching (1999)
Student Project (Visual Basic) – Apriori (2003)
MSc IKBS Student (2003)
Machine Learning Educational Tool – Java (2003)
Student Project – Online Product Recommendation using Cold Fusion (2003)
MSc IKBS Student (2003) Muziah Muhammad
Image Recognition – Java *Failed (2003)
Document Classifier with Naïve Bayes – Java
(2005)
Leaf Image Recognition - Java (2009)
Leaf Image Recognition – Java (2009)
Findings – Java/ASP/PHP before 2009
▪ Java
▪ among the mostly used language to create AI applications
▪ Machine learning, neural networks, genetic algorithms, to robotics and mobile applications
▪ Various libraries but still not at convergence AI language
▪ ASP/PHP
▪ Web based intelligent applications are still developing
Modern AI Programming Languages
▪ Why modern programming languages?
▪ The advancement of computing power, CPU to GPU
▪ Web 3.0 to …
▪ Mobile computing
▪ Cloud computing
▪ Wearable computing
▪ Big data/Data Science
▪ IOT
▪ Platform
Web 3.0
5 Top AI Programming Language 2020 (Dev.to)
1. Python – rapid coding of ML, data analytics 2. LISP – inductive logic
3. Prolog – pattern matching, unification, backtracking 4. Matlab – complex mathematical, tensorflow, etc.
Allow complete AI workflow application
5. Java – neural networks, search algorithms
Verdict: Python
10 best Language for AI (techindia)
▪ 1. Python – extensive libraries for AI – numpy, pybrain, sklearn
▪ 2. R-language – ai, ml
▪ 3. Java – ai, ml, search, nn, mobile app
▪ 4. Lisp – prototyping, not recommended for beginners
▪ 5. JavaScript – lib by Google, Facebook – node.js, tensorflow.js, DialogFlow
▪ 6. Prolog – still broadly used (academic?)
▪ 7. Haskell - academic
▪ 8. Julia – dynamic programming, ml
▪ 9. C++ - libraries for Math, scalable ML
▪ 10. AIML – ai, ml
▪ Verdict: Python
Top AI languages trends in 2020 (analyticsinsight)
▪ Python – offers least code, libraries for AI/ML
▪ R – multi-paradigm, statistical focus basis for ML
▪ Java – JVM tech, search, genetic programming, nn
▪ Scala – JVM tech, concurrency, ScalaNLP, DeepLearningforj
▪ Rust – voted among the most loved language in
stack overflow
Top 5 AI language 2020 (websensa)
▪ Python – best AI & ML solutions, lib (sklearn, TensorFlow, Pytorch, Sckit-learn, Keras)
▪ Java – mobile app, Weka, Massive Online Analysis, Java-ML
▪ Javascript – tool for AI/ML, visualization -tensorflow.js, brain.js, ml.js
▪ R - statistics, predictive analysis – AI/ML lib (Dplyr, Ggplot2)
▪ Go – fast growing lang. for ML – speed – AI/ML
(GoLearn, GoML)
Top 10 languages AI Developer (readwrite)
▪ Python
▪ Java
▪ Julia
▪ LISP
▪ Scala
▪ R
▪ Haskell
▪ Rust
▪ Prolog
▪ Matlab
So, what language for AI?
▪ No definite answer for what best for AI projects
▪ Programming language created with different
requirement and consideration for developing AI projects
▪ Factors to consider, e.g.,
▪ Scale – proof of concept, small app, large deployment
▪ Budget – software, hardware
▪ Platform – standalone, cloud, web, mobile
▪ Skill
Our experience - chatbot
▪ Implementation of
▪ response and assist
academic related queries
▪ Frequent intent pattern by mining social messages
▪ Discover user intent
▪ Application/Technology
▪ Web-based, JavaScript, DialogFlow
Our experience – text/language translation system
▪ Translation from BM to Kadazandusun, 2nd phase project to implement deep learning translation with PHP + Python
Web-based Speech Recognition
▪ Implementation of web-based speech recognition for Kadazandusun language learning
Plate Recognition
Findings
▪ Selection of programming language for AI project depends on
▪ Project type
▪ Platform Deployment
▪ Support
▪ Skill
▪ Cost
▪ Python – rapid development, however, may have
slower runtime
Our cost experience
▪ Hardware for implementing Python with
TensorFlow in speech recognition and text translation
▪ GPU enabled notebook NVIDIA GTX 1650 (RM4000) or similar – relatively enough for prototyping of small
data/deep learning architecture
▪ GPU for middle performance with NVIDIA RTX3080 (RM3360 GPU only), complete system > RM7k
AI Platform
▪ What?
▪ Using machine to automate AI processes
▪ Predefined functions and models to implement related AI task in a framework.
▪ It involves hardware or software that allows better
organization, faster and accurate decision.
Example of AI Platform
▪ Google Cloud AI
▪ Tensorflow
▪ IBM Watson
▪ Amazon AI Service
▪ Microsoft AI – Azure
▪ H20
▪ Infosys Nia
▪ Etc.
Example: Microsoft Azure – Cognitive Service
Case study
▪ What application of AI in this case? – CBR?
▪ How to acquire the resources? – past cases?
▪ How to represent the resources to be used in the AI system? – Case->sentencing?
▪ What language is the most suitable to
develop the system??
Take Home Quiz
▪ What language would you use to develop:
▪ Expert System
▪ AI Games
▪ Optimization
▪ Robot
▪ Web-based Recommendation
▪ Mobile-based Recognition (speech/image etc..)