Tyshawn  Braun

Tyshawn Braun

1600375200

Long Short-Term Memory Networks Are Dying: What’s Replacing It?

The rise and fall of the LSTM

The Long Short-Term Memory — LSTM — network has become a staple in deep learning, popularized as a better variant to the recurrent neural networks. As methods seem to come and go faster and faster as machine learning research accelerates, it seems that LSTM has begun its way out.

Let’s take a few steps back and explore the evolution language modelling, from its baby steps to modern advancements in complex problems.


Fundamentally, like any other supervised machine learning problem, the goal of language modelling is to predict some output y given a document d. The document d must be represented somehow in numerical form, which can be processed by a machine learning algorithm.

The initial solution for representing documents as numbers is bag of words (BoW). Each word occupied one dimension in a vector, and each value represented how many times the word appeared in the document. This method, however, doesn’t take into account ordering of the words, which matters a lot (I live to work, I work to live).

In order to remedy this problem, n-grams are used. These are sequences of n words, in which each element indicates the presence of a word combination. If there are 10,000 words in our dataset and we want to store bi-grams, we will need to store 10,000² unique combinations. For any reasonably good modelling, we will likely need tri-grams or even quad-grams, which each raise the vocabulary size to another power.

Obviously, n-grams and BoW cannot handle even slightly complex language tasks. Their solutions involve vectorization procedures that are too sparse, large, and unable to capture the spirit of language itself. A solution? The recurrent neural network.

Instead of using high-dimensional, sparse vectorization solutions that attempt to feed the entire document to the model at once, a recurrent neural network works with the sequential nature of text. RNNs can be expressed as a recursive function, where A is the transformation function applied at each timestep, h is the set of hidden layer states, and x represents the set of data.

#ai #deep-learning #artificial-intelligence #machine-learning #data-science

What is GEEK

Buddha Community

Long Short-Term Memory Networks Are Dying: What’s Replacing It?

A Comparative Analysis of Recurrent Neural Networks

Recurrent neural networks, also known as RNNs, are a class of neural networks that allow previous outputs to be used as inputs while having hidden states. RNN models are mostly used in the fields of natural language processing and speech recognition.

The vanishing and exploding gradient phenomena are often encountered in the context of RNNs. The reason why they happen is that it is difficult to capture long term dependencies because of multiplicative gradient that can be exponentially decreasing/increasing with respect to the number of layers.

Gated Recurrent Unit (GRU) and Long Short-Term Memory units (LSTM) deal with the vanishing gradient problem encountered by traditional RNNs, with LSTM being a generalization of GRU.

1D Convolution_ layer_ creates a convolution kernel that is convolved with the layer input over a single spatial (or temporal) dimension to produce a tensor of outputs. It is very effective for deriving features from a fixed-length segment of the overall dataset. A 1D CNN works well for natural language processing (NLP).

DATASET: IMDb Movie Review

TensorFlow Datasets is a collection of datasets ready to use, with TensorFlow or other Python ML frameworks, such as Jax. All datasets are exposed as [_tf.data.Datasets_](https://www.tensorflow.org/api_docs/python/tf/data/Dataset), enabling easy-to-use and high-performance input pipelines.

“imdb_reviews”

This is a dataset for binary sentiment classification containing substantially more data than previous benchmark datasets. It provides a set of 25,000 highly polar movie reviews for training, and 25,000 for testing.

Import Libraries

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

Load the Dataset

import tensorflow as tf
import tensorflow_datasets

imdb, info=tensorflow_datasets.load("imdb_reviews", with_info=True, as_supervised=True)
imdb

Image for post

info

Image for post

Training and Testing Data

train_data, test_data=imdb['train'], imdb['test']

training_sentences=[]
training_label=[]
testing_sentences=[]
testing_label=[]
for s,l in train_data:
  training_sentences.append(str(s.numpy()))
  training_label.append(l.numpy())
for s,l in test_data:
  testing_sentences.append(str(s.numpy()))
  testing_label.append(l.numpy())
training_label_final=np.array(training_label)
testing_label_final=np.array(testing_label)

Tokenization and Padding

vocab_size=10000
embedding_dim=16
max_length=120
trunc_type='post'
oov_tok='<oov>'
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
tokenizer= Tokenizer(num_words=vocab_size, oov_token=oov_tok)
tokenizer.fit_on_texts(training_sentences)
word_index=tokenizer.word_index
sequences=tokenizer.texts_to_sequences(training_sentences)
padded=pad_sequences(sequences, maxlen=max_length, truncating=trunc_type)
testing_sequences=tokenizer.texts_to_sequences(testing_sentences)
testing_padded=pad_sequences(testing_sequences, maxlen=max_length)
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Embedding

Multi-layer Bidirectional LSTM

#imdb #convolutional-network #long-short-term-memory #recurrent-neural-network #gated-recurrent-unit #neural networks

Build & Deploy a Telegram Bot with short-term and long-term memory

Create a Chatbot from scratch that remembers and reminds events with Python

Summary

In this article, using Telegram and Python, I will show how to build a friendly Bot with multiple functions that can chat with question-answering conversations (short-term information) and store user data to recall in the future (long-term information).

All this started because a friend of mine yelled at me for not remembering her birthday. I don’t know if that has ever happened to you. So I thought I could pretend I remember birthdays while I actually have a Bot doing it for me. Now I know what you’re thinking, why building something from scratch instead of using one of the millions of calendar apps around? And you’re right, but for nerds like us … what’s the fun in that?

Through this tutorial, I will explain step by step how to build an intelligent Telegram Bot with Python and MongoDB and how to deploy it for free with Heroku and Cron-Job,using my Dates Reminder Bot as an example(link below).

I will present some useful Python code that can be easily applied in other similar cases (just copy, paste, run) and walk through every line of code with comments so that you can replicate this example (link to the full code below).

In particular, I will go through:

  • Setup: architecture overview, new _Telegram _Bot generation, _MongoDB _connection, _Python _environment.
  • Front-end: code the Bot commands for user interaction with pyTelegramBotAPI.
  • Back-end: create the server-side app with _flask _and threading.
  • Deploy the Bot through Heroku and Cron-Job

#artificial-intelligence #programming #web-development #chatbots #engineering #build & deploy a telegram bot with short-term and long-term memory

Tyshawn  Braun

Tyshawn Braun

1600375200

Long Short-Term Memory Networks Are Dying: What’s Replacing It?

The rise and fall of the LSTM

The Long Short-Term Memory — LSTM — network has become a staple in deep learning, popularized as a better variant to the recurrent neural networks. As methods seem to come and go faster and faster as machine learning research accelerates, it seems that LSTM has begun its way out.

Let’s take a few steps back and explore the evolution language modelling, from its baby steps to modern advancements in complex problems.


Fundamentally, like any other supervised machine learning problem, the goal of language modelling is to predict some output y given a document d. The document d must be represented somehow in numerical form, which can be processed by a machine learning algorithm.

The initial solution for representing documents as numbers is bag of words (BoW). Each word occupied one dimension in a vector, and each value represented how many times the word appeared in the document. This method, however, doesn’t take into account ordering of the words, which matters a lot (I live to work, I work to live).

In order to remedy this problem, n-grams are used. These are sequences of n words, in which each element indicates the presence of a word combination. If there are 10,000 words in our dataset and we want to store bi-grams, we will need to store 10,000² unique combinations. For any reasonably good modelling, we will likely need tri-grams or even quad-grams, which each raise the vocabulary size to another power.

Obviously, n-grams and BoW cannot handle even slightly complex language tasks. Their solutions involve vectorization procedures that are too sparse, large, and unable to capture the spirit of language itself. A solution? The recurrent neural network.

Instead of using high-dimensional, sparse vectorization solutions that attempt to feed the entire document to the model at once, a recurrent neural network works with the sequential nature of text. RNNs can be expressed as a recursive function, where A is the transformation function applied at each timestep, h is the set of hidden layer states, and x represents the set of data.

#ai #deep-learning #artificial-intelligence #machine-learning #data-science

Marlon  Boyle

Marlon Boyle

1594312560

Autonomous Driving Network (ADN) On Its Way

Talking about inspiration in the networking industry, nothing more than Autonomous Driving Network (ADN). You may hear about this and wondering what this is about, and does it have anything to do with autonomous driving vehicles? Your guess is right; the ADN concept is derived from or inspired by the rapid development of the autonomous driving car in recent years.

Image for post

Driverless Car of the Future, the advertisement for “America’s Electric Light and Power Companies,” Saturday Evening Post, the 1950s.

The vision of autonomous driving has been around for more than 70 years. But engineers continuously make attempts to achieve the idea without too much success. The concept stayed as a fiction for a long time. In 2004, the US Defense Advanced Research Projects Administration (DARPA) organized the Grand Challenge for autonomous vehicles for teams to compete for the grand prize of $1 million. I remembered watching TV and saw those competing vehicles, behaved like driven by drunk man, had a really tough time to drive by itself. I thought that autonomous driving vision would still have a long way to go. To my surprise, the next year, 2005, Stanford University’s vehicles autonomously drove 131 miles in California’s Mojave desert without a scratch and took the $1 million Grand Challenge prize. How was that possible? Later I learned that the secret ingredient to make this possible was using the latest ML (Machine Learning) enabled AI (Artificial Intelligent ) technology.

Since then, AI technologies advanced rapidly and been implemented in all verticals. Around the 2016 time frame, the concept of Autonomous Driving Network started to emerge by combining AI and network to achieve network operational autonomy. The automation concept is nothing new in the networking industry; network operations are continually being automated here and there. But this time, ADN is beyond automating mundane tasks; it reaches a whole new level. With the help of AI technologies and other critical ingredients advancement like SDN (Software Defined Network), autonomous networking has a great chance from a vision to future reality.

In this article, we will examine some critical components of the ADN, current landscape, and factors that are important for ADN to be a success.

The Vision

At the current stage, there are different terminologies to describe ADN vision by various organizations.
Image for post

Even though slightly different terminologies, the industry is moving towards some common terms and consensus called autonomous networks, e.g. TMF, ETSI, ITU-T, GSMA. The core vision includes business and network aspects. The autonomous network delivers the “hyper-loop” from business requirements all the way to network and device layers.

On the network layer, it contains the below critical aspects:

  • Intent-Driven: Understand the operator’s business intent and automatically translate it into necessary network operations. The operation can be a one-time operation like disconnect a connection service or continuous operations like maintaining a specified SLA (Service Level Agreement) at the all-time.
  • **Self-Discover: **Automatically discover hardware/software changes in the network and populate the changes to the necessary subsystems to maintain always-sync state.
  • **Self-Config/Self-Organize: **Whenever network changes happen, automatically configure corresponding hardware/software parameters such that the network is at the pre-defined target states.
  • **Self-Monitor: **Constantly monitor networks/services operation states and health conditions automatically.
  • Auto-Detect: Detect network faults, abnormalities, and intrusions automatically.
  • **Self-Diagnose: **Automatically conduct an inference process to figure out the root causes of issues.
  • **Self-Healing: **Automatically take necessary actions to address issues and bring the networks/services back to the desired state.
  • **Self-Report: **Automatically communicate with its environment and exchange necessary information.
  • Automated common operational scenarios: Automatically perform operations like network planning, customer and service onboarding, network change management.

On top of those, these capabilities need to be across multiple services, multiple domains, and the entire lifecycle(TMF, 2019).

No doubt, this is the most ambitious goal that the networking industry has ever aimed at. It has been described as the “end-state” and“ultimate goal” of networking evolution. This is not just a vision on PPT, the networking industry already on the move toward the goal.

David Wang, Huawei’s Executive Director of the Board and President of Products & Solutions, said in his 2018 Ultra-Broadband Forum(UBBF) keynote speech. (David W. 2018):

“In a fully connected and intelligent era, autonomous driving is becoming a reality. Industries like automotive, aerospace, and manufacturing are modernizing and renewing themselves by introducing autonomous technologies. However, the telecom sector is facing a major structural problem: Networks are growing year by year, but OPEX is growing faster than revenue. What’s more, it takes 100 times more effort for telecom operators to maintain their networks than OTT players. Therefore, it’s imperative that telecom operators build autonomous driving networks.”

Juniper CEO Rami Rahim said in his keynote at the company’s virtual AI event: (CRN, 2020)

“The goal now is a self-driving network. The call to action is to embrace the change. We can all benefit from putting more time into higher-layer activities, like keeping distributors out of the business. The future, I truly believe, is about getting the network out of the way. It is time for the infrastructure to take a back seat to the self-driving network.”

Is This Vision Achievable?

If you asked me this question 15 years ago, my answer would be “no chance” as I could not imagine an autonomous driving vehicle was possible then. But now, the vision is not far-fetch anymore not only because of ML/AI technology rapid advancement but other key building blocks are made significant progress, just name a few key building blocks:

  • software-defined networking (SDN) control
  • industry-standard models and open APIs
  • Real-time analytics/telemetry
  • big data processing
  • cross-domain orchestration
  • programmable infrastructure
  • cloud-native virtualized network functions (VNF)
  • DevOps agile development process
  • everything-as-service design paradigm
  • intelligent process automation
  • edge computing
  • cloud infrastructure
  • programing paradigm suitable for building an autonomous system . i.e., teleo-reactive programs, which is a set of reactive rules that continuously sense the environment and trigger actions whose continuous execution eventually leads the system to satisfy a goal. (Nils Nilsson, 1996)
  • open-source solutions

#network-automation #autonomous-network #ai-in-network #self-driving-network #neural-networks

Games DApp

Games DApp

1606981211

Matic Network in Blockchain Gaming

Matic Network is getting lots of attraction amidst the blockchain game developers. This is because, their competition has stepped away from the gaming scene. Matic - as a general purpose platform, capable of creating all types of DApps, and have already build 60+ DApps on Matic Network.

As a result Matic Network is busy gaining a lots of new gaming partners. They have already been integrated into many gaming DApps.

Key reasons why DApps chooses Matic Network

  • Near-instant blockchain transactions
  • Low Transaction fees >> less than 1/1000th of the fees on the Ethereum mainchain
  • Seamless migration for existing Ethereum DApps
  • Access to, and assistance with, a wide range of developer tooling.
  • Unparalleled technical support for developers.

If you have an idea to build your own Gaming DApp - you could benefit from matic network’s high-speed, low-fee infrastructure and our assistance to transform your DApp from a great idea into a successful DApp business.

Being a Predominant DApp Game Development Company, GamesDApp helps you to Build DApp Game on matic network and also expertize in developing various popular games on the blockchain network using smart contract.

Hire Blockchain Game Developers >> https://www.gamesd.app/#contactus

#matic network #build dapp game on matic network #dapp game on matic network #matic network in blockchain gaming #matic network for game development