Decision Tree Classifiers in Julia - GeeksforGeeks

01 Nov, 2020
In statistics in Julia, classification is the problem of identifying to which of a set of categories (sub-populations) a new observation belongs, on the basis of a training set of data containing observations (or instances) whose category membership is known.
In the terminology of machine learning, classification is considered an instance of supervised learning, i.e., learning where a training set of correctly identified observations is available.
Some of the classification techniques which we have are:
Linear Classifiers: Logistic Regression, Naive Bayes ClassifierNearest NeighborSupport Vector MachinesDecision TreesBoosted TreesRandom ForestNeural Networks
Linear Classifiers: Logistic Regression, Naive Bayes Classifier
Nearest Neighbor
Support Vector Machines
Decision Trees
Boosted Trees
Random Forest
Neural Networks
A Decision Tree is a simple representation of classifying examples. It is a Supervised Machine Learning where the data is continuously split according to a certain parameter.
Decision trees are commonly used in operations research and operations management. If in practice, decisions have to be taken online with no recall under incomplete knowledge, a decision tree should be paralleled by a probability model as the best choice model or online selection model algorithm. Another use of decision trees is as a descriptive means for calculating conditional probabilities.
A decision tree has mainly three components:
Root Nodes: It represents the entire population or sample and this further gets divided into two or more homogeneous sets.Edges/Branch: Represents a decision rule and connect to the next node.Leaf nodes: Leaf nodes are the nodes of the tree that have no additional nodes coming off them. They don’t split the data any further
Root Nodes: It represents the entire population or sample and this further gets divided into two or more homogeneous sets.
Edges/Branch: Represents a decision rule and connect to the next node.
Leaf nodes: Leaf nodes are the nodes of the tree that have no additional nodes coming off them. They don’t split the data any further
Decision Tree is a flow chart like structure
use axis-aligned linear decision boundaries to partition or bisect data
Divide and conquer approach
Packages and Requirements
Pkg.add(“DecisionTree”)
Pkg.add(“DataFrames”)
Pkg.add(“Gadly”)
Julia
# using the packagesusing DataFramesusing DecisionTree  # Loading the Data# https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/df = readtable("breastc.csv")
Output:
Julia
# using gadly packageusing Gadfly  plot(df, x = Xfeatures,     y = Ylabel, Geom.histogram,      color = :Class,      Guide.xlabel("Features"))
Output:
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Get array dimensions and size of a dimension in Julia - size() Method
Searching in Array for a given element in Julia
Find maximum element along with its index in Julia - findmax() Method
Get number of elements of array in Julia - length() Method
Exception handling in Julia
Getting the maximum value from a list in Julia - max() Method
Working with Excel Files in Julia
Decision Making in Julia (if, if-else, Nested-if, if-elseif-else ladder)
Getting the absolute value of a number in Julia - abs() Method
Working with Date and Time in Julia