Recurrent Neural Networks (RNN): Deep Learning for Sequential Data

Recurrent Neural Networks (RNN) are a class of Artificial Neural Networks that can process a sequence of inputs in deep learning and retain its state while processing the next sequence of inputs. Traditional neural networks will process an input and move onto the next one disregarding its sequence. Data such as time series have a sequential order that needs to be followed in order to understand. Traditional feed-forward networks cannot comprehend this as each input is assumed to be independent of each other whereas in a time series setting each input is dependent on the previous input.

Illustration 1: source

In Illustration 1 we see that the neural network (hidden state) _A _takes an _xt _and outputs a value _ht. _The loop shows how the information is being passed from one step to the next. The inputs are the individual letters of ‘JAZZ’ and each one is passed on to the network A in the same order it is written (i.e. sequentially).

Recurrent Neural Networks can be used for a number of ways such as:

  • Detecting the next word/letter
  • Forecasting financial asset prices in a temporal space
  • Action modeling in sports (predict the next action in a sporting event like soccer, football, tennis etc)
  • Music composition
  • Image generation

RNN vs Autoregressive Models

An autoregressive model is when a value from data with a temporal dimension are regressed on previous values up to a certain point specified by the user. An RNN works the same way but the obvious difference in comparison is that the RNN looks at all the data (i.e. it does not require a specific time period to be specified by the user.)

Yt = β0 + β1yt-1 + Ɛt

The above AR model is an order 1 AR(1) model that takes the immediate preceding value to predict the next time period’s value (yt). As this is a linear model, it requires certain assumptions of linear regression to hold–especially due to the linearity assumption between the dependent and independent variables. In this case, **_Yt _**and **_yt-1 _**must have a linear relationship. In addition there are other checks such as autocorrelation that have to be checked to determine the adequate order to forecast Yt.

An RNN will not require linearity or model order checking. It can automatically check the whole dataset to try and predict the next sequence. As demonstrated in the image below, a neural network consists of 3 hidden layers with equal weights, biases and activation functions and made to predict the output.

Source

These hidden layers can then be merged to create a single recurrent hidden layer. A recurrent neuron now stores all the previous step input and merges that information with the current step input.

Source

Advantages of an RNN

  • It can model non-linear temporal/sequential relationships.
  • No need to specify lags to predict the next value in comparison to and autoregressive process.

Disadvantages of an RNN

  • Vanishing Gradient Problem
  • Not suited for predicting long horizons

#deep learning #neural networks #artificial inteligence #rnn #deep learning

What is GEEK

Buddha Community

Recurrent Neural Networks (RNN): Deep Learning for Sequential Data

Recurrent Neural Networks (RNN): Deep Learning for Sequential Data

Recurrent Neural Networks (RNN) are a class of Artificial Neural Networks that can process a sequence of inputs in deep learning and retain its state while processing the next sequence of inputs. Traditional neural networks will process an input and move onto the next one disregarding its sequence. Data such as time series have a sequential order that needs to be followed in order to understand. Traditional feed-forward networks cannot comprehend this as each input is assumed to be independent of each other whereas in a time series setting each input is dependent on the previous input.

Illustration 1: source

In Illustration 1 we see that the neural network (hidden state) _A _takes an _xt _and outputs a value _ht. _The loop shows how the information is being passed from one step to the next. The inputs are the individual letters of ‘JAZZ’ and each one is passed on to the network A in the same order it is written (i.e. sequentially).

Recurrent Neural Networks can be used for a number of ways such as:

  • Detecting the next word/letter
  • Forecasting financial asset prices in a temporal space
  • Action modeling in sports (predict the next action in a sporting event like soccer, football, tennis etc)
  • Music composition
  • Image generation

RNN vs Autoregressive Models

An autoregressive model is when a value from data with a temporal dimension are regressed on previous values up to a certain point specified by the user. An RNN works the same way but the obvious difference in comparison is that the RNN looks at all the data (i.e. it does not require a specific time period to be specified by the user.)

Yt = β0 + β1yt-1 + Ɛt

The above AR model is an order 1 AR(1) model that takes the immediate preceding value to predict the next time period’s value (yt). As this is a linear model, it requires certain assumptions of linear regression to hold–especially due to the linearity assumption between the dependent and independent variables. In this case, **_Yt _**and **_yt-1 _**must have a linear relationship. In addition there are other checks such as autocorrelation that have to be checked to determine the adequate order to forecast Yt.

An RNN will not require linearity or model order checking. It can automatically check the whole dataset to try and predict the next sequence. As demonstrated in the image below, a neural network consists of 3 hidden layers with equal weights, biases and activation functions and made to predict the output.

Source

These hidden layers can then be merged to create a single recurrent hidden layer. A recurrent neuron now stores all the previous step input and merges that information with the current step input.

Source

Advantages of an RNN

  • It can model non-linear temporal/sequential relationships.
  • No need to specify lags to predict the next value in comparison to and autoregressive process.

Disadvantages of an RNN

  • Vanishing Gradient Problem
  • Not suited for predicting long horizons

#deep learning #neural networks #artificial inteligence #rnn #deep learning

Artificial Neural Networks — Recurrent Neural Networks

With convolution neural networks, we can create deep learning models which are really good at classifying images and can be scaled to process a wide variety of image data. When processing sequence data, such as text data, time series data or audio data where we are looking information which spans through time and forms a sequence of information. CNN’s may not be a good choice.

With the case of sequential data, where next set of data can be dependent on the previous set it is necessary to have some sort of history to be maintained, which can be leveraged for predicting the outcome. For example, if we are looking at predicting the next word in a sequence, it is necessary to be able to relate the previous words and make sure that everything fits.

For this kind of data, we need specialised networks, which can keep a history and use it to predict the next data point. But why can’t we use feed forward networks to model this requirement? The problem in using a feed forward network for such kind of data is

  • Feed forward networks require a fixed length of data input which is set beforehand. With sequence data, it is not necessary that the input will be of fixed length.
  • Long term dependencies, in other words, historical state cannot be maintained.

In sequence modelling, the network should be able to -

  • Handle variable sized inputs, such as variable length sentences.
  • Track long term dependencies. In other words, maintain a history.
  • Preserve order. In language modelling it is necessary that the order of the sentences is maintained so that the appropriate prediction can be made.
  • Parameter sharing across sequence.

In these cases, we turn to Recurrent Neural Networks. Hence, RNNs are a type of neural network which remembers the previous output and uses it in the calculation of the current output. They have a sort of feedback loop, which allows the information to persist in the network and is used in the processing of the next input sequence. Below is an example of a RNN.

Image for post

The following steps describe how a RNN works in simple terms -

  1. Take the input x
  2. Predict the output y
  3. Update the internal state h and use h in the next time step.

In the update of the cell state h, the previous state h(t-1) is also used. The calculation is a matrix multiplication with weight matrix for the current state and the previous state with the cell state from the previous time step and the input vector x. Then a activation function is applied to introduce non-linearity. If the above image is unrolled, it will look like this -

#deep-learning #data-science #recurrent-neural-network #machine-learning #sequence-model #deep learning

Marget D

Marget D

1618317562

Top Deep Learning Development Services | Hire Deep Learning Developer

View more: https://www.inexture.com/services/deep-learning-development/

We at Inexture, strategically work on every project we are associated with. We propose a robust set of AI, ML, and DL consulting services. Our virtuoso team of data scientists and developers meticulously work on every project and add a personalized touch to it. Because we keep our clientele aware of everything being done associated with their project so there’s a sense of transparency being maintained. Leverage our services for your next AI project for end-to-end optimum services.

#deep learning development #deep learning framework #deep learning expert #deep learning ai #deep learning services

Noah  Rowe

Noah Rowe

1593528240

Deep Learning 101 —  Neural Networks Explained

The past few decades have witnessed a massive boom in the penetration as well as the power of computation, and amidst this information revolution, AI has radically changed the way people and businesses make decisions. The poster-boys for these cutting edge AI solutions — Deep Learning and Neural Networks, despite their hype, are understood only by a few.

In this article, I will try to explain what Neural Networks are, and how they function, and their strengths and limitations. And hopefully, convince you that they’re much simpler than they’re thought to be.

_NOTE: Deep Learning is an subset of Machine Learning, and if you’re unsure how that works, I’d advise you check out _[this article]

Before diving right in, let’s explore a simpler problem, to establish a few fundamental concepts.

Logistic Regression

Assume we’re a credit card company targeting people without an adequate credit history. Using the historical data of its users, we want to decide whether a new applicant should be given the credit card or not.

Assume the data we have to make the decision is the following.

· Age

· Salary

· Education

· City

· Company

· Designation

Note: I realize that the latter 4 are “qualitative” variables, but for this illustration, let’s assume we can somehow quantify them

The final decision is a Yes or No, thus making it a classification problem. To solve this we’ll make a small modification to our linear regression approach — After multiplying the variables with their weights (the technically correct name of the slopes or coefficients we used in Linear Regression) and adding them, (and the constant), the result can be any number, and to convert it into a Yes/No decision, we will have to process it further, i.e. pass it through a function.

One option for g could be a simple Threshold function:

![Threshold Function]

Threshold Function

Ie. The decision being No if the sum product of variables and weights is z<0 and Yes if Z>=0

However often, instead of absolute Yes or No, we may want the probability of the result, and also because the algorithm computing the optimum weights work better for smooth (or in technical terms, differentiable) functions, we use a different function called the sigmoid.

Sigmoid Function

Tying it all together, for a new customer, we can input the different variables (age, salary etc.), sum their product with them with the weights, and apply the sigmoid function to get the probability of his eligibility for the card, and this whole process is called Logistic Regression.

Activation Functions

The reason for taking the detour through Logistic Regression was to introduce the concept of activation functions. The threshold or sigmoid function used in Logistic Regression were examples of activation functions.

Any function applied on the sum-product of variables and weights(note that there will be a corresponding weight for each variable) is known as an activation function. Apart from the Threshold and sigmoid functions discussed above, a few others that are commonly used

ReLU (Rectified Linear Unit):

![ReLU graph]

This means returning Z as it is if it’s positive, and returning 0 otherwise.

Tanh (Hyperbolic Tan):

Tanh graph

This is sigmoid stretched downwards on the y-axis so that it’s centred at (0,0) instead of (0,0.5)

These, along with their small variations are the most commonly used activation functions in Neural Networks because of reasons beyond the scope of this article.

#data-science #neural-networks #artificial-intelligence #deep-learning #machine-learning #deep learning

Deep learning on graphs: successes, challenges, and next steps

TL;DR This is the first in a [series of posts] where I will discuss the evolution and future trends in the field of deep learning on graphs.

complex social network

Deep learning on graphs, also known as Geometric deep learning (GDL) [1], Graph representation learning (GRL), or relational inductive biases [2], has recently become one of the hottest topics in machine learning. While early works on graph learning go back at least a decade [3] if not two [4], it is undoubtedly the past few years’ progress that has taken these methods from a niche into the spotlight of the ML community and even to the popular science press (with Quanta Magazine running a series of excellent articles on geometric deep learning for the study of manifoldsdrug discovery, and protein science).

Graphs are powerful mathematical abstractions that can describe complex systems of relations and interactions in fields ranging from biology and high-energy physics to social science and economics. Since the amount of graph-structured data produced in some of these fields nowadays is enormous (prominent examples being social networks like Twitter and Facebook), it is very tempting to try to apply deep learning techniques that have been remarkably successful in other data-rich settings.

There are multiple flavours to graph learning problems that are largely application-dependent. One dichotomy is between node-wise and graph-wise problems, where in the former one tries to predict properties of individual nodes in the graph (e.g. identify malicious users in a social network), while in the latter one tries to make a prediction about the entire graph (e.g. predict solubility of a molecule). Furthermore, like in traditional ML problems, we can distinguish between supervised and unsupervised (or self-supervised) settings, as well as transductive and inductive problems.

Similarly to convolutional neural networks used in image analysis and computer vision, the key to efficient learning on graphs is designing local operations with shared weights that do message passing [5] between every node and its neighbours. A major difference compared to classical deep neural networks dealing with grid-structured data is that on graphs such operations are permutation-invariant, i.e. independent of the order of neighbour nodes, as there is usually no canonical way of ordering them.

Despite their promise and a series of success stories of graph representation learning (among which I can selfishly list the [acquisition by Twitter] of the graph-based fake news detection startup Fabula AI I have founded together with my students), we have not witnessed so far anything close to the smashing success convolutional networks have had in computer vision. In the following, I will try to outline my views on the possible reasons and how the field could progress in the next few years.

**Standardised benchmarks **like ImageNet were surely one of the key success factors of deep learning in computer vision, with some [6] even arguing that data was more important than algorithms for the deep learning revolution. We have nothing similar to ImageNet in scale and complexity in the graph learning community yet. The [Open Graph Benchmark] launched in 2019 is perhaps the first attempt toward this goal trying to introduce challenging graph learning tasks on interesting real-world graph-structured datasets. One of the hurdles is that tech companies producing diverse and rich graphs from their users’ activity are reluctant to share these data due to concerns over privacy laws such as GDPR. A notable exception is Twitter that made a dataset of 160 million tweets with corresponding user engagement graphs available to the research community under certain privacy-preserving restrictions as part of the [RecSys Challenge]. I hope that many companies will follow suit in the future.

**Software libraries **available in the public domain played a paramount role in “democratising” deep learning and making it a popular tool. If until recently, graph learning implementations were primarily a collection of poorly written and scarcely tested code, nowadays there are libraries such as [PyTorch Geometric] or [Deep Graph Library (DGL)] that are professionally written and maintained with the help of industry sponsorship. It is not uncommon to see an implementation of a new graph deep learning architecture weeks after it appears on arxiv.

Scalability is one of the key factors limiting industrial applications that often need to deal with very large graphs (think of Twitter social network with hundreds of millions of nodes and billions of edges) and low latency constraints. The academic research community has until recently almost ignored this aspect, with many models described in the literature completely inadequate for large-scale settings. Furthermore, graphics hardware (GPU), whose happy marriage with classical deep learning architectures was one of the primary forces driving their mutual success, is not necessarily the best fit for graph-structured data. In the long run, we might need specialised hardware for graphs [7].

**Dynamic graphs **are another aspect that is scarcely addressed in the literature. While graphs are a common way of modelling complex systems, such an abstraction is often too simplistic as real-world systems are dynamic and evolve in time. Sometimes it is the temporal behaviour that provides crucial insights about the system. Despite some recent progress, designing graph neural network models capable of efficiently dealing with continuous-time graphs represented as a stream of node- or edge-wise events is still an open research question.

#deep-learning #representation-learning #network-science #graph-neural-networks #geometric-deep-learning #deep learning