Overview of deep learning with Python

AI Basics


Want to learn more about deep learning? Deep learning is making great strides among companies looking to build intelligent systems using vast amounts of unstructured data. Deep learning works on the theory of artificial neural networks. In this article, we'll learn the basics of deep learning using Python and see how neural networks work.

Prepare for your next deep learning interview in 2022 with these common deep learning interview questions.

What is deep learning?

Deep learning is a branch of machine learning that deals with algorithms inspired by the structure and function of the human brain. Build intelligent models and solve complex problems using artificial neural networks. We primarily use deep learning with unstructured data.

deep learning

Learn the basics of neural networks with this Deep Learning with Python article.

Your AI/ML career is just around the corner!

AI engineer master's programExplore the program

Your AI/ML career is just around the corner!

What is a neural network?

A neural network is a machine modeled after the human brain. Each layer consists of nodes. Connections between nodes represent the flow of information from one layer to the next. Neurons are connected using weights. Next, send the input to the neuron. After this, process and output the data.

Below is an example of a basic neural network.

neural network

Neural networks have three main layers.

  • Input layer: This layer is responsible for accepting input.
  • Hidden layer: This layer processes the input data to find hidden information and performs feature extraction.
  • Output layer: This layer provides the desired output.

Below is an example of a neural network that takes pixels of an image, processes them using hidden layers, and classifies the shape of the image. Here it's a triangle.

Activation function

The following operations are performed within each neuron:

  • Each input value is multiplied by the weight of the channel through which it passes.
  • Computes the sum of weighted products. This is called a weighted sum.
  • Adds a neuron-specific bias to the weighted sum.
  • Then apply a certain function to the final sum.

activation function

There are many activation functions available for neural networks.

sigmoid function

Sigmoid functions are used for models that need to predict probabilities as output. Exists between 0 and 1.

sigmoid function.

Your AI/ML career is just around the corner!

AI engineer master's programExplore the program

Your AI/ML career is just around the corner!

threshold function

This is a threshold-based activation function. The function is activated if the value of x is greater than a certain value, otherwise it is not fired.

threshold function

Rectification function

This is the most widely used activation function and outputs X if X is positive and 0 otherwise.

rectifier function

hyperbolic tangent function

This function is similar to the sigmoid function and is bound to the range (-1, 1).

hyperbola

cost function

The Cost function returns the difference between the predicted output of the neural network and the actual output from a set of labeled training data. The minimum cost value can be obtained by iteratively adjusting the weights and biases throughout the training process.

The formula for the cost function is:

Here, Y is the predicted value and Y is the actual output.

cost function

How do neural networks work?

  • The network consists of layers of neurons. Associate each neuron with a random number called a bias.
  • Neurons in each layer transmit information through channels to neurons in the next layer.
  • These channels are associated with values ​​called weights.
  • Weights and biases determine the information passed from neuron to neuron.
  • Neurons in each layer send information to neurons in the next layer.
  • The output layer provides the predicted output.

Now let's build a neural network that predicts the price of a bicycle based on some features.

  • Input features such as cc, mileage, abs etc. are fed into the input layer.
  • Hidden layers help improve output accuracy.
  • Each connection is assigned a weight. Neurons take a subset of input and process it.

—-> x1*w1 + x2*w2 + b1

—-> Φ(x1* w1 + x2*w2 + b1), Φ is the activation function.

  • The information reaching neurons in the hidden layer is influenced by their respective activation functions.
  • The processed information is sent to the output layer through a weighted channel.
  • Compare the predicted output with the original output value.
  • The cost function identifies the prediction error and reports it to the neural network. This is called backpropagation.
  • The weights are adjusted to minimize the error.
  • Train the network using the new weights.
  • Determine the cost again and continue backpropagating until you can no longer reduce the cost.
  • A neural network is considered trained when the value of the cost function is minimized.

Now, learn more about another topic in the Deep Learning with Python article: gradient descent.

Your AI/ML career is just around the corner!

AI engineer master's programExplore the program

Your AI/ML career is just around the corner!

gradient descent

Gradient descent is an approach to minimizing a cost function. Gradient is a numerical calculation that allows you to adjust the parameters of a neural network to minimize deviations in the output. The cost function is plotted against the predicted value, and the goal is to find a particular weight value for which the loss is minimal.

deep learning platform

Several widely used and popular deep learning frameworks are useful for building neural network models. Common ones include Tensorflow, Keras, Pytorch, and DL4J.

library.

For a hands-on demo, we created a model using the TensorFlow library.

What is TensorFlow?

TensorFlow, developed by Google, is an open source library used to define and perform tensor computations. A tensor is just another name for a multidimensional array.

Can run on either CPU or GPU. You can create data flow graphs with nodes and edges. TensorFlow is commonly used for machine learning applications such as neural networks.

Now, let's move on to the last section of this article about deep learning with Python: building a model that can predict handwritten digits using the MNIST database.

Deep learning demo using Python: Predict handwritten digits

/DigitPrediction

  • Import the required libraries.
  • Load the dataset.
  • Check the total number of training and testing samples.
  • Visualize your data.
  • Build the model.
  • Loss and optimization.
  • Test your model to check its accuracy.

As you can see above, the accuracy of our model is 91%, which is a decent accuracy.

Master basic and advanced topics such as machine learning, deep learning, computer vision, NLP, speech recognition, reinforcement learning, and more with Simplilearn's AI and Machine Learning Professional Certification Program. Register now!

conclusion

After completing this article, you should have learned the basics of deep learning and understood how neural networks work. We reviewed various deep learning techniques and implemented a demo to classify handwritten digits using the MNIST database.

If you have any questions related to this article about deep learning with Python, please write them in the comments section of this article. Our experts will solve your questions as soon as possible.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *