0% found this document useful (0 votes)
10 views

Automate Decision Tree& Machine Learning

Uploaded by

pukingvomit
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Automate Decision Tree& Machine Learning

Uploaded by

pukingvomit
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Automate a

decision tree
2

Lesson Objectives

You will learn about:


▪The decision tree and how to automate it.
▪ Machine learning: advantages and disadvantages.
1.
Content
What is a decision tree and?
Why we use a decision tree?
Decision tree
• This is a visual representation of a series of related choices, similar to a flowchart.
• It maps out possible outcomes and helps individuals or organizations weigh
different options based on factors like costs, probabilities, and benefits.
• Each node represents a decision point, with branches leading to further choices and
potential consequences.
• These trees help make informed decisions by visualizing the potential impact of
different path.
Decision tree example
Decision tree explanation
1. Start: The process starts with the student at the center.
2. Attend Class: The first decision point is whether the student attends class.
1. Yes: If the student attends class, they move to the next decision point, which is whether they
pass the exam.
1. Pass: If they pass the exam, they have likely achieved a good understanding of the
course material.
2. Fail: If they fail the exam, they may need to put in more effort to understand the
material or seek help from the teacher or a tutor.
2. No: If the student does not attend class, they move to the next decision point, which is
whether they join activities.
1. Yes: If they join activities, they are still engaging in learning experiences outside of the
classroom.
2. No: If they do not join activities and do not attend class, they may be missing out on
important learning opportunities.
Automated a decision tree
▪ We can automate a decision tree, through programming by using:
▪ If …. Else
▪ For item in
Decision tree example
Automated a decision tree
def decision_tree(student):
"""
This function takes a student object (with attributes like attended_class, passed_exam,
joined_activities)
and returns a string describing their likely understanding.
"""
if student.attended_class:
if student.passed_exam:
return "Likely good understanding of the course material."
else:
return "May need more effort or help to understand the material."
else:
if student.joined_activities:
return "Engaging in learning experiences outside of the classroom."
else:
return "May be missing out on important learning opportunities."
2.
Content
Machine learning
13

Machine learning
▪ Machine learning is a subset of artificial intelligence that enable computers
to solve tasks that are infeasible or too cumbersome with traditional
programming languages.
▪ A dataset is a collection of data values in a tabular format.
▪ Machine learning, you don’t make an algorithm. The computer has to learn
to solve a problem for itself, it’s called training.
Supervised training
▪ The computer is given a lot of data that has already been organised and
labelled.
▪ For example: the computer might be given millions of images.
▪ The images have been labelled to say if they show faces or not.
▪ The computer will learn to tell the difference between faces and other
images.
Unsupervised training
▪ The data is not sorted or organised.
▪ The computer will put the pictures into groups that are similar.
▪ Groups are called clusters, all the images in a cluster will have a lot in
common.
Reinforcement learning
▪ Reinforcement is feedback that lets it know if it has moved towards the
right goal.
▪ Gradually the computer learns to produce output that is closer to the
right result.
Deep learning
▪ Deep learning combines the other methods into highly complex learning
process.
▪ Deep learning can produce very powerful results.
▪ Deep learning uses a type of computer called neural network.
Advantages and disadvantages
Advantages:
▪ You don’t need to tell the computer how to solve the problem.
▪ You give the computer a goal and it will work out its own solution.
Disadvantages:
▪ The computer needs a lot of data.
▪ The data must be diverse and varied.
▪ Machine learning can go wrong.
End of topic questions
1. What is a decision tree in the context of machine learning?
2. What does a decision tree using Python help in achieving?
3. In machine learning, what is a major advantage of using decision trees?
4. What is the disadvantage of machine learning?
5. What is a leaf node in a decision tree?

You might also like