Unit 5
Unit 5
Unit 5
Machine Learning
UNIT-5
Neural Networks and Deep Learning
Aditya College of Engineering
Machine Learning
Aditya College of Engineering
Machine Learning
Aditya College of Engineering
Machine Learning
Aditya College of Engineering
Machine Learning
Aditya College of Engineering
Keras
Summarise the model:
• Understanding the model is very important phase to properly use it for training and
prediction purposes. Keras provides a simple method, summary to get the full information
about the model and its layers.
Train and Predict the model:
Model provides function for training, evaluation and prediction process. They are as follows −
• compile − Configure the learning process of the model
• fit − Train the model using the training data
• evaluate − Evaluate the model using the test data
• predict − Predict the results for new input.
Functional API
• Sequential API is used to create models layer-by-layer. Functional API is an alternative
approach of creating more complex models. Functional model, you can define multiple input
or output that share layers. First, we create an instance for model and connecting to the
layers to access input and output to the model.
Machine Learning
Aditya College of Engineering
Introduction to Artificial Neural Networks with Keras
• In the above example, we have two hidden layers that are not directly
exposed to the input the planning can refer to have many hidden
layers in our network model usually if we increase the number of
hidden layers the model will work more efficiently.
• The final layer is called the output layer and it is responsible for the
final outcome the choice of activation function in the output layer
strongly depends on the type of problem.
• A multi-class classification problem may have multiple neurons in the
final output layer one for each class in this scenario softmax activation
function may be used to output our probability of the network.
Machine Learning
Aditya College of Engineering
Implementation
• To construct our first multi-layer perception first we import sequential
model API from Keras.
• We are using Dense and dropout layers so we have to import them
from our Keras.
• To split our dataset we will use the train tests split function which is
available in scikit-learn model selection and plot_model will help us to
display our model.
• Finally, we import the load txt function from numpy which will be
used to load our data set let’s import them here we work with the
titanic data set.
Machine Learning
Aditya College of Engineering
Machine Learning