· A decision tree is a graphical representation of all possible solutions to a decision based on certain conditions.

· Decision Trees are versatile machine learning algorithms that can perform both classification and regression tasks, and even multioutput tasks. They most widely used to supervised learning.

· They are powerful algorithms, capable of fitting complex datasets.

· Decision Trees works on CART(Classification and Regression Trees) algorithm

This is a simple Decision Tree

Decision Tree Terminology

Before we get into how a decision tree works we need to understand some terminologies of a decision tree.

· Root node: This is the top most node from which a decision tree is…


I tried to create a model in Tensorflow version 2.3.1 using keras version 2.4.0 , which was trained on the MNIST dataset. This dataset contains 60000 images of handwritten digits from 0 to 9 each of size 28x28.

I have used 3 different activation function in the last layer (output layer)for this, namely softmax , sigmoid and tanh.

model1 = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=[28, 28]),
tf.keras.layers.Dense(300, activation=”relu”),
tf.keras.layers.Dense(100, activation=”relu”),
tf.keras.layers.Dense(10, activation=”softmax”)
])

From the code above , the activation function for the last layer is softmax (recommended for multi-class classification)

model2 = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=[28, 28]),
tf.keras.layers.Dense(300, activation=”relu”),
tf.keras.layers.Dense(100, activation=”relu”),
tf.keras.layers.Dense(10, activation=”sigmoid”)
])

Marmikpatani

Machine Learning/Deep Learning enthusiast, currently pursuing MBA-TECH in Computer Science from NMIMS.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store