Book Image

Python: Advanced Guide to Artificial Intelligence

By : Giuseppe Bonaccorso, Rajalingappaa Shanmugamani
Book Image

Python: Advanced Guide to Artificial Intelligence

By: Giuseppe Bonaccorso, Rajalingappaa Shanmugamani

Overview of this book

This Learning Path is your complete guide to quickly getting to grips with popular machine learning algorithms. You'll be introduced to the most widely used algorithms in supervised, unsupervised, and semi-supervised machine learning, and learn how to use them in the best possible manner. Ranging from Bayesian models to the MCMC algorithm to Hidden Markov models, this Learning Path will teach you how to extract features from your dataset and perform dimensionality reduction by making use of Python-based libraries. You'll bring the use of TensorFlow and Keras to build deep learning models, using concepts such as transfer learning, generative adversarial networks, and deep reinforcement learning. Next, you'll learn the advanced features of TensorFlow1.x, such as distributed TensorFlow with TF clusters, deploy production models with TensorFlow Serving. You'll implement different techniques related to object classification, object detection, image segmentation, and more. By the end of this Learning Path, you'll have obtained in-depth knowledge of TensorFlow, making you the go-to person for solving artificial intelligence problems This Learning Path includes content from the following Packt products: • Mastering Machine Learning Algorithms by Giuseppe Bonaccorso • Mastering TensorFlow 1.x by Armando Fandango • Deep Learning for Computer Vision by Rajalingappaa Shanmugamani
Table of Contents (31 chapters)
Title Page
About Packt
Contributors
Preface
19
Tensor Processing Units
Index

Classification using logistic regression


The most common method for classification is using logistic regression. Logistic regression is a probabilistic and linear classifier. The probability that vector of input features is a member of a specific class can be written formally as the following equation: 

In the above equation:

  • Y represents the output,
  • i represents one of the classes
  • x represents the inputs
  • w represents the weights
  • b represents the biases
  • z represents the regression equation
  • ϕ represents the smoothing function or model in our case

The preceding equation represents that probability that x belongs to class i when w and b are given, is represented by function ϕ(z). Thus the model has to be trained to maximize the value of probability.

Logistic regression for binary classification

For binary classification, we define the model function ϕ(z) to be the sigmoid function, written as follows:

The sigmoid function produces the value of y to lie between the range [0,1]. Thus we can use the value...