Thursday, August 12, 2021

Decision tree - machine learning


machine learning,decision tree machine learning,decision tree,decision tree in machine learning,decision tree algorithm,machine learning tutorial,decision tree algorithm in machine learning,decision trees,decision tree analysis,decision tree classifier,decision tree tutorial,python machine learning,machine learning course,decision tree in data mining,machine learning algorithms,decision tree example,decision tree machine learning example

A decision tree (DT) is a class of machine learning algorithms, which is used in different tasks such as classification and regression. also, this kind of tree is utilized in data mining and business intelligence.  Different decision tree algorithms exist, the most well-known of which are ID3, C4.5, C50, and CART.

The word "tree" refers to the graphical form that this decision-making tool takes. It's presented in the form of a connexed, non-oriented graph. This technique is used in supervised learning or tree building based on existing data.

Examples

  • The decision trees used in the regression are used to find a quantitative value. For example, a tree that can predict house prices.
  • The classification decision tree's goal is to predict a class to which the output variable belongs.
>


Decision Tree Terminologies

  • The root node is where the decision tree begins. It will then be split into homogenous nodes. To optimize the tree, this node must be carefully picked.
  • Leaf Node: Leaf nodes are the last nodes, and after getting a leaf node, the tree cannot be split any further. In the case of classification, the classes are represented by the leaf node.
  • Child node: indicates the other nodes.
  • Splitting: This is the process of splitting nodes into sub-nodes based on certain conditions.
  • Branch: is a sub-tree that is part of the tree.
decision tree,decision trees,decision tree classifier,decision tree tutorial,decision tree machine learning,terminologies,general algorithm for decision tree.,decision tree gini,decision tree terms,basic terminology used in trees,decision tree in data mining,decision regions,decision tree in python,decision tree information gain,decision tree tutorial for beginners,decision tree using python,decision tree python,what is a decision tree


Why do we use a decision tree algorithm?

There are several algorithms in machine learning. Selecting the best appropriate algorithm is crucial to model success. The decision tree is very easy to understand since it allows you to present all the possible choices structured like a real tree. It analyzes all possible cases and decisions in a compliant manner. Also, it imitates the thinking process of man when making a decision.

 E(n,a) =  n1/n* I(p1, n1) + n2/n* I(p2, n2)+...+nn/n* I(pn, nn)

The GAIN  is calculated for each invoice, which has the highest payout value is the most appropriate to be the Root Node.

GAIN(a)=I(p,n)-E(n,a)

Example : 

We have two classes in this example: "Yes" and "No". 

decision tree,decision tree example,decision trees,decision tree solved example,decision tree analysis,decision tree machine learning,decision tree algorithm,decision tree classifier,decision tree in machine learning,decision trees example,decision tree with a simple solved example,decision tree algorithm in python,decision tree in data mining,id3 algorithm decision tree,decision tree problem,decision tree tutorial,decision tree example solved

The first step in creating a decision tree is to select the appropriate characteristic to serve as the root node.



decision tree,decision trees,decision tree example,decision tree solved example,decision tree analysis,decision tree machine learning,decision tree in data mining,decision tree algorithm,decision tree algorithm example,decision trees example,decision tree classifier,decision tree algorithm in python,decision tree tutorial,decision tree in machine learning,decision tree problem,decision tree examples,decision tree problem in big data analytics


CODE: Decision Tree Implementation Using Python 

Step 1: Import the necessary libraries. 
We'll utilize the Sklearn package in this example.
from sklearn import tree

Step 2: Import the dataset. 
The Sklearn package includes a variety of datasets that may be used to demonstrate the behavior of various algorithms. 
The IRIS is a well-known and often used dataset. It's a multivariate data set with 150 samples separated into three groups/labels (Iris setosa, Iris virginica, and Iris versicolor), with the data differentiated by four features (sepal.length, sepal.width, petal.length, petal.width).

decision tree,decision trees,iris dataset,decision tree classifier,decision tree in data mining,iris dataset python,iris dataset analysis,decision,iris dataset analysis project report,decision tree algorithm in data mining,iris dataset analysis solution python,iris dataset analysis ml project,decision tree analysis,iris dataset analysis ml project in python,decision tree algorithm,iris dataset analysis data science project,decision tree machine learning
extracted from IRIS dataset
from sklearn.datasets import load_iris
iris = load_iris()
data, target = iris.data, iris.target
Step 3: Train the model
clf = tree.DecisionTreeClassifier()
clf = clf.fit(data, target)

Step 4: predict new data 
tree.plot_tree(clf)
Output: 
result of decision tree implementation using python

Conclusion 

Decision Tree is a predictive model which is used in different fields like data mining, machine learning, and statistics. It is a flowchart in tree form that consists of nodes, branch, and leaf nodes (the final output).



Previous Post
Next Post

0 Comments: