[CSAL] AI

Objectives

  • Show understanding of how graphs can be used to aid
    Artificial Intelligence (AI)

  • Purpose and structure of a graph
    Use A* and Dijkstra’s algorithms to perform searches
    on a graph

  • Show understanding of  how artificial neural networks
    have helped with machine learning

  • Show understanding of Deep Learning, Machine
    Learning and Reinforcement Learning and the reasons
    for using these methods.

  • Understand machine learning categories, including
    supervised learning, unsupervised learning

  • Show understanding of back propagation of errors and
    regression methods in machine learning

Graphs

  • A data structure consisted of some nodes and connecting edges
  • Graphs helped to model problems involving networks of relationships
  • e.g. Telephone network, social networks
  • A side note: Facebook called their programming interface to access their database: graph API 

Types of Graph

  • Undirected Graph:
    • The "relationship" can be two way, thus one node can traverse to the other and vice versa
  • Directed Graph:
    • The edge is one way thus you can traverse from one node to other (following the arrow) but not backwards

Dijkstra's algorithm

The algorithm to find the shortest path from a weighted graph

Data structure to keep track in Dijkstra's algorithm:

  • Shortest Distance (so far) from the start to the node
  • Previous node to visit (for backtracking)
  • Is the node visited
  • e.g.:
Node Distance/Cost Previous Explored/Visited
A (start) 0 null True
B 3 A False
C 2 A True
... ... ... ...

Exercise: perform Dijkstra's algorithm on the following graph, and find the shortest path and the cost to get from node 0 to node 4, with the help of a table similar to previous slide. 

A* Algorithm

  • Find the closest path from start to the goal
  • Similar to Dijkstra, but more efficient
  • Comparing A* with Dijkstra:
    • https://www.youtube.com/watch?v=g024lzsknDo
  • Algorithm explained
    • https://www.youtube.com/watch?v=-L-WgKMFuhE&t=492s

Algorithm

  • Each node has these values:
    • G (cost) of the node from start
    • H (heuristic cost) cost of the node from destination
    • F (cost) = G + H
  • Set start node as current and marked as visited
  • Explore all neighbor of the current and updates
    • G = current G + edge cost
    • H = how "far" from the goal, linear distance e.g. (without considering obstacles)
  • Choose, any unvisited node with lowest F to be current and repeat, until current is goal

Machine Learning

Machine learning is one realm of AI

Types of learning

  • The choice of learning type usually depends on the task to complete
    • Supervised Learning
    • Unsupervised Learning
    • Reinforcement Learning

Supervised Learning

  • Usually works with classification problem
  • The data (training set) is prepared with the label which indicates which class the data belongs to
  • Example: https://teachablemachine.withgoogle.com/

Unsupervised Learning

  • No labelling is required
  • Usually work with grouping problems
  • The system will try to conclude from its experience
  • One example is online shopping, based on user browsing history and provide recommendations on products

Reinforcement Learning

  • The system is provided with the State of the environment
  • Take some action, and based on the action, certain reward is given
  • Based on the past experience, the system try to maximize the reward by taking different approaches on action
  • Example: https://www.youtube.com/watch?v=JNKvJEzuNsc

Deep Learning - Neural Networks

Neural network mimics the way human brain operates

Neural Network

  • Input Layer: Input layer is the input data to the network
  • Output Layer: The result from the network, usually there is multiply of output nodes and each one has it's probability
  • Hidden Layer: 
    • Depending on the network, there can be multiply hidden layer
    • Each node is a activation function, which has:
      • weight: apply on each input, so e.g. above picture each node has 3 weight for 3 inputs
      • weight is adjust through "training"

Training process (supervised)

  1. All weights are initialized to some value
  2. Batches of labelled training data is sent to the input layer
  3. Result from the output layer is compared with the known labels, where the error (also called loss) is calculated - which indicates how accurate is the prediction (from 0-1)
  4. Then the error is feedback to the network, from output backwards to the hidden layers to adjust the weights, this method is called back propagation of errors
  5. Weights in Hidden layers is updated based on the errors, then depending on the performance of the network, see if next epoch of training is required. If so, back to (2)

try: https://playground.tensorflow.org/

Made with Slides.com