0% found this document useful (0 votes)
89 views29 pages

Artificial Intelligence (Comp Sci A-Level)

Uploaded by

Mal Eficent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views29 pages

Artificial Intelligence (Comp Sci A-Level)

Uploaded by

Mal Eficent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AS & A LEVEL COMPUTER SCIENCE 9618

ARTIFICIAL INTELLIGENCE
Artificial intelligence is the ability of a computer or a robot controlled by a computer to do
tasks that are usually done by humans because they require human intelligence.
Notes:
 The device learning from its environment and the data it receives becoming increasingly
sophisticated, it updates its responses, showing the ability to use automated learning
via artificial neural networks(Deep learning)
 When you design a machine, depending on the interactions you make with it, it keeps
on learning and learning on data and it’s responses keep on improving with time.
 Machine keeps on learning via deep learning until it improves it’s responses.

TYPES OF ARTIFICIAL INTELLIGENCE

 Narrow AI: Machine has superior performance to a human when doing a specific task
 General AI: Machine is similar in its performance to a human in any intellectual task
 Strong AI: machine has superior performance to a human in many tasks

Note: AI becomes intelligent through machine and deep learning

1 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DIJIKSTRA’S ALGORITHM
 Method of finding the shortest path between two points on a graph
 Each point on the graph is called a node or a vertex
 This algorithm is the basis of technology such as GPS, Google maps and many telephone
networks therefore it is a strong part of AI
TERMINOLOGIES
 Vertex / Node: Label of the graph or two points that we are connecting to.
 Working value: Temporary value given to a vertex and can be taken as distance
 Final value: Final calculated value to reach a node

Vertex Letter Order of Labeling Final Value


Working value

Steps:
 We always begin with the root node
 Locate the adjacent nodes connected directly to the root node. From the nodes
connected to the root we choose a node with a smallest working value and will be the
next source.

2 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DIJKSTRA’S ALGORITHM
Steps:
 After the root node, for the next source we keeping on comparing working values. If the
new working value is smaller , we update else we keep the previous working value
 At every stage keep on visiting all adjacent nodes even those that where visited previous
so long as they are connected to the current root node.
 Always update the working value during comparisons
 At the last comparisons, we have to generate the shortest path to the goal

3 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DIJIKSTRA’S ALGORITHM

4 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DIJKSTRA’S ALGORITHM
Step 1:
Initialize base to 0
Initialize nodes to K on the diagram
Step 2: Make a table

Town1 Town2 Town3 Town4 Town5 Town6


K K K K K K

4 5 2 k k k

3 5 2 k k k

3 5 2 11 3 13

3 5 2 9 3 8

5 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

A* ALGORITHM
With a A* algorithm we have a starting and nodes to traverse
Node to destination. Works like a
F(n) = h(n) + g(n) smart guess, because you don’t
h know the exact distance to next
node but looking at (h) you can
guess the size of the distance

NODE

g Movement cost from starting


Previous node n node to any other node. Used to
calculate the generated path

6 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

A* ALGORITHM
A* algorithm is based on Dijkstra's, but adds an extra heuristic value (intelligent
guess ) on how far we have to go to reach the destination most efficiently
12 11
5
B F
16
4

14 12
G
S 5
3
10
C E
11 4
6
7 2
D

7 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

A* ALGORITHM
Qtn: Using the above graph find the shortest path to reach G from S
F(n) = g(n) + h(n)
SCE
F(n) = g(n) + h(n)
Actual Heuristic = 13 + 4
Cost Value = 17 Shortest Path =
SCD SCDEG
SB F(n) = g(n) + h(n)
F(n) = g(n) + h(n) = 10 + 6
= 4 + 12 = 16
= 16 SCDE
SC F(n) = g(n) + h(n)
F(n) = g(n) + h(n) = 12 + 4
= 3 + 11 = 16
= 14 SCDEG
F(n) = g(n) + h(n) = 17 + 0 = 17

8 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

A* ALGORITHM

9 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

A* ALGORITHM

10 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MACHINE LEARNING AND DEEP LEARNING

AI Machines think in a way


ML that is similar to that of
DL human brains. They
handle huge amounts
of data using artificial
neural networks

Intelligent machines think


and behave like humans

Systems learn without being programmed to learn

11 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MACHINE LEARNING
 Is a subset of AI in which algorithms are trained and learn from their past experience.
 Systems learn without being programmed to learn

APPLICATIONS OF MACHINE LEARNING


 Increased efficiency in healthy care and diagnostic ( robots working as humans )
 Better marketing technologies based on buying behaviors of a target group
 News feeds on social media networks
 Banks loan approval processes

HOW MACHINE LEARNING RECOGNIZES OBJECTS


Machine learning keeps on learning from past experiences and data it is feed. Below are the
types of data used in machine leaning in the input- output process

 Unlabeled data : Type of data to which tag or label is not attached


 Labeled data: The unlabeled becomes labeled data the moment meaning is attached (
Label, tag)

12 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MACHINE LEARNING
LABELED DATA
With labeled data a machine learning model can be trained to know the target answer based on
data objects that are fully recognized or given names.
Machine is being trained with objects that are fully identified with their names

Rectangle Circle Triangle

Machine learning robot is trained with


labeled data

Machine will be given


unlabeled data and basing
on its training it predict
the correct or expected
outcome

13 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MACHINE LEARNING
UNLABELED DATA
Machine is trained but with unnamed or unidentified data that need to be manually recognized

Examples
 Spam filtering
 Search engine

Machine will predict the expected


outcomes by matching different
patterns of the input data

Note: We use labeled and unlabeled data to train a machine to learn

14 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

TYPES OF MACHINE LEARNING


1. Supervised Learning
2. Unsupervised learning
3. Reinforcement Learning

15 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

TYPES OF MACHINE LEARNING


SUPERVISED LEARNING
using known tasks with given outcomes to enable a computer program to
improve its performance in accomplishing similar tasks.
UNSUPERVISED LEARNING
Using large number of tasks with unknown outcomes to enable a computer
program to improve its performance in accomplishing similar tasks
REINFORMENT LEARNING
Using a large number of tasks with unknown outcomes and the use of feedback to
enable a computer program to improve its performance in accomplishing similar
tasks

16 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

SUPERVISED LEARNING
1. Using labeled data to teach a machine each and everything
2. After a machine has acquired enough data then it use that to make predictions which
are compared to the expected outcomes
3. With supervised learning a machine can predict the future outcomes based on past data
4. A machine keep on learning and learning basing on labeled data that it trained with.
After learning is then able to make its own decisions
5. With supervised learning a machine will require both input and output for a complete
training
6. It is from the output that a machine will keep learning through feedback.
7. After training a machine with labeled objects, then one of the object is placed in front of
a machine to see if it can make perfect prediction.
8. When there is a wrong output or prediction then there is an error in the machine
learning algorithm
9. Results are always compared with the expected outcome, if there is any error , the
model needs further refinement ( Back Propagation )
Note:
In supervised learning always train with labeled data and then test with unlabeled data to
make predictions

17 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

UNSUPERVISED LEARNING

MACHINE LEARNING

Using Modeling the


world Case study
Learn / Correct

Update its belief to agree with its


observation of the world
Notes:
1. Machine is given unlabeled data and tries to identify the data it’s self through patterns.
2. Machine is able to identify hidden patterns from input data provided
3. Makes data more readable and more organized, classifies unlabeled real data
4. Model finally will do grouping or clustering of data
5. Give a machine unlabeled data and it will return grouped or classification
6. Machines will always update their responses though back propagation

18 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

REINFORCEMENT LEARNING
Notes:
1. Not trained
2. Uses try and error algorithm to determine which action gives the highest or optimal
outcome
3. Does not know what the right outcome is until a task is completely finished
For example:
1. Kid learning to walk
2. Finding the shortest path

Goal Process of
learning is
through feedback
of machine
model behavior

Destination

19 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DEEP LEARNING
 Machine think in away that is similar to that of human brains
 They handle huge amounts of data using Artificial Neural Networks
 Structures algorithms in layers ( input, output and hidden layers) to create an artificial
neural network
 Deep learning is a subset of machine learning
 Deep learning is a type of machine learning inspired by the structure of human brain.
 This structure is called Artificial Neural Networks
 Extract patterns from data using neural networks
Case study:
Human brains have many neurons connected to each other which help us to think. Deep
learning mimic the same architecture
HOW DEEP LEARNING IS ABLE TO THINK
1. Excellent identifying patterns
2. Learn and make intelligent decisions on its own
3. Based on artificial neuron networks system is able to think like human using these
networks

20 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DEEP LEARNING
Note:
1. Artificial neural networks are based on the interconnection between neurons
in the human brain. The system is able to think like human using these neural
networks and its performance improves with more data
2. The hidden layers are where data from the input is processed into something
which can be sent to the output layer
3. With deep learning, site performance improves with more data
4. Deep learning work hand in hand with machine learning and this makes it
possible to take unlabeled objects and then recognize through a sophisticated
set of algorithm.
5. Large amount of unlabeled data is input into the model. Labeled data is then
entered in the model to make sure it gives the correct responses if output is
not perfect, the machine is refined with back propagation.
APPLICATION OF DEEP LEARNING
Deep learning can be used to turn monochrome(black and white) photos into
colored photographs

21 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DEEP LEARNING
NEURON NETWORKS

1. Each neuron has weight giving strength to each signal


2. Weights are numbers that determine how the neurons do their math to get
output
3. Everything is about Maths in the neural network

REASONS FOR HAVING MULTIPLE HIDDEN LAYERS IN ARTIFICIAL NEURAL NETWORKS

1. Enables deep learning to take place


2. When the problem you are trying to solve has a higher level of complexity it
requires more layers to solve
3. To enable the neural networks to learn and make decisions on its own
4. To improve the accuracy of results

22 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DEEP LEARNING

23 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

HOW ARTIFICIAL NEURAL NETWORKS ENABLE MACHINE LEARNING

1. Artificial neural networks are intended to replicate the way human brains
work
2. Weights ate assigned for each connection between nodes
3. The data are input at the input layer and are passed into the system
4. They are analyzed at each subsequent hidden layer where outputs are
calculated
5. This process of learning is repeated many times to achieve optimum outputs
6. Decisions can be made without being specifically programmed
7. The deep learning net will have created complex feature detectors
8. The output layer provides the results
9. Back propagation of errors will be used to correct any errors that have been
made

24 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DIFFERENCES BETWEEN MACHINE LEARNING AND DEEP LEARNING

MACHINE LEARNING DEEP LEARNING

Enables machines to make decisions on Enables machines to make decisions


their own based on past data using artificial neural networks

Needs only a small amount of data to The system needs large amount of data
carry out the training during the training stages

Most of the features in the data used Deep learning machine learns the
need to be identified in advance and features of the data from the data itself
then manually coded into the system and it does not need to be identified in
advance

25 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

BACK PROPAGATION

1. When designing neural networks, it is important to give random weighting to


each neural connection.
2. It is important to train the neural networks in the development phases
3. The training program is iterative, the outputs produced from the system are
compared with the expected results and any difference in the two results is
calculated
4. Incase the random value used does not give perfect results then the
algorithm reduces the margin by updating the random weight value
5. The errors are propagated back into the neural networks in order to update
the initial networking weightings
6. This training process is repeated until the desired outputs are eventually
obtained
7. System weighting are adjusted to minimize the difference between actual and
expected results
8. All neurons which are contributing to the error get their math adjusted

26 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

BACK PROPAGATION PROCESS


1. The initial outputs from the system are compared to the expected output
2. The system weightings are adjusted to minimize the difference between actual and
expected results
3. Once the errors in the output have been eliminated, the neural network is functioning
correctly
4. If the error are still too large, the weightings are altered
Note: Back Propagation is about a machine learning from its mistakes

TYPES OF PROPAGATION
Static: Map static inputs for static output. Weights are adjusted based on the entire training
set, rather than individual
Recurrent: Activation is fixed forward until a fixed value is achieved. Keeps on happening
iteratively or repeatedly
REGRESSION
 Is one of the way of analyzing data before it is input into a system
 Is used to make predictions from given data by learning some relationships between the
input and output
 Helps in understanding how the value of a dependent variable changes when values of
independent variables are also changed

27 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

BACK PROPAGATION
In machine learning we can predict for example sales of the full year by attaching
weight on sales of the previous year

28 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

CLASSIFICATION ANALYSIS
1. Model tries to predict the correct label of a given input data

 Two shapes are classified by AI as rectangles even is they are of different size
and format. This is done through comparing and contrasting patterns
Notes:
1. Results always have to be compared with expected output and incase of any
errors, the model needs further refinement( back propagation)
2. Incase an error is got the machine keeps on improving and making sure the
error does not happen again.

29 Davis_Kazibwe@2023KIS

You might also like