Question

# This week is about conditional statements and conditional learning. Think about the decisions you make in...

This week is about conditional statements and conditional learning. Think about the decisions you make in your everyday life. How many are conditional? Buy this, not that. Do this, not that, etc. So, how does this fit into algorithms? Why do computers need to make decisions? Discuss the merits of decision tree structures in computing and why they are necessary. Be sure to highlight what decision tree structures do and how they are important, or if they are at all, to programs and computing in general.

1) Conditional Statements

Conditional statements, expressions and constructs are features of a computer programming language, which perform different computations or actions depending on whether a specified condition evaluates to true or false. In otherwords, Conditional statements help you to make a decision based on certain conditions. These conditions are specified by a set of conditional statements having boolean expressions which are evaluated to a boolean value true or false.

2)Conditional statement in algorithm

Hree we are going to see how conditional statement is placed in algorithm. There are many conditional statement is available like IF/ELSE, AND/OR, WHILE. For example: In IF/ELSE scenario, we can code the program to provide the output if its matches with conditions defined in IF statement and if the condition doesnt met then program will execute the ELSE condition.

Example:

if Age > 18 :
{
Print "You are eligible to vote"
}

Else :
{
Print "You are not eligible to vote"
}

In the above conditional statement, we defined 1 condition and instructed program to execute 1 statement if its matches the IF conditions and execute the 2 statement if the IF condition doesnt met.

3) Decision Tree and Why computer need to make decisions ?

Decision tree alogorithm is a flow like a tree structure that works on the principle of conditions. It has mainly attributed that include internal nodes, branches and a terminal node. Every internal node holds a “test” on an attribute, branches hold the conclusion of the test and every leaf node means the class label.

Example:

Terms in Decision tree:
Branches - Division of the whole tree is called branches.
Root Node - Represent the whole sample that is further divided.
Splitting - Division of nodes is called splitting.
Terminal Node - Node that does not split further is called a terminal node.
Decision Node - It is a node that also gets further divided into different sub-nodes being a sub node.
Pruning - Removal of subnodes from a decision node.
Parent and Child Node - When a node gets divided further then that node is termed as parent node whereas the divided nodes or the sub-nodes are termed as a child node of the parent node.

Decision trees are considered to be widely used in data science. It is a key proven tool for making decisions in complex scenarios. Decision trees create a tree-like structure by computing the relationship between independent features and a target. This is done by making use of functions that are based on comparison operators on the independent features.

4) Decision tree structure Merit

It is effective and is very simple.
It can be used while dealing with the missing values in the dataset.
It can take care of numeric as well as categorical features.
Help determine worst, best and expected values for different scenarios.
It can be combined with other decision techniques.
A decision tree algorithm can be used to solve both regression and classification problems.
A Decision tree model is very intuitive and easy to explain to technical teams as well as stakeholders.
Results that are generated from DT does not require any statistical or mathematics knowledge to be explained.

#### Earn Coins

Coins can be redeemed for fabulous gifts.