Connect with us

# Tuning the learning rate in Gradient Descent

Published

on

In most Supervised Machine Learning problems we need to define a model and estimate its parameters based on a training dataset. A popular and easy-to-use technique to calculate those parameters is to minimize model’s error with Gradient Descent. The Gradient Descent estimates the weights of the model in many iterations by minimizing a cost function at every step.

## The Gradient Descent Algorithm

Here is the algorithm:

```Repeat until convergence { Wj = Wj - λ θF(Wj)/θWj }
```

Where Wj is one of our parameters (or a vector with our parameters), F is our cost function (estimates the errors of our model), θF(Wj)/θWj is its first derivative with respect to Wj and λ is the learning rate.

If our F is monotonic, this method will give us after many iterations an estimation of the Wj weights which minimize the cost function. Note that if the derivative is not monotonic we might be trapped to local minimum. In that case an easy way to detect this is by repeating the process for different initial Wj values and comparing the value of the cost function for the new estimated parameters.

Gradient Descent is not always the best method to calculate the weights, nevertheless it is a relatively fast and easy method. If you want to read more about Gradient Descent check out the notes of Ng for Stanford’s Machine Learning course.

## Tuning the learning rate

In order for Gradient Descent to work we must set the λ (learning rate) to an appropriate value. This parameter determines how fast or slow we will move towards the optimal weights. If the λ is very large we will skip the optimal solution. If it is too small we will need too many iterations to converge to the best values. So using a good λ is crucial.

### Adapting the value of learning rate for different dataset sizes

Depending on the cost function F that we will select, we might face different problems. When the Sum of Squared Errors is selected as our cost function then the value of θF(Wj)/θWj gets larger and larger as we increase the size of the training dataset. Thus the λ must be adapted to significantly smaller values.

One way to resolve this problem is to divide the λ with 1/N, where N is the size of the training data. So the update step of the algorithm can be rewritten as:

```Wj = Wj - (λ/N)*θF(Wj)/θWj
```

You can read more about this on Wilson et al. paper “The general inefﬁciency of batch training for gradient descent learning”.

Finally another way to resolve this problem is by selecting a cost function that is not affected by the number of train examples that we use, such as the Mean Squared Errors.

### Adapting learning rate in each iteration

Another good technique is to adapt the value of λ in each iteration. The idea behind this is that the farther you are from optimal values the faster you should move towards the solution and thus the value of λ should be larger. The closer you get to the solution the smaller its value should be. Unfortunately since you don’t know the actual optimal values, you also don’t know how close you are to them in each step.

To resolve this you can check the value of the error function by using the estimated parameters of the model at the end of each iteration. If your error rate was reduced since the last iteration, you can try increasing the learning rate by 5%. If your error rate was actually increased (meaning that you skipped the optimal point) you should reset the values of Wj to the values of the previous iteration and decrease the learning rate by 50%. This technique is called Bold Driver.

## Extra tip: Normalize your Input Vectors

In many machine learning problems normalizing the input vectors is a pretty common practice. In some techniques normalization is required because they internally use distances or feature variances and thus without normalization the results would be heavily affected by the feature with the largest variance or scale. Normalizing your inputs can also help your numerical optimization method (such as Gradient Descent) converge much faster and accurately.

Even though there are several ways to normalize a variable, the [0,1] normalization (also known as min-max) and the z-score normalization are two of the most widely used. Here is how you can calculate both of them:

```XminmaxNorm = (X - min(X))/(max(X)-min(X));
XzscoreNorm = (X - mean(X))/std(X);
```

Hope this works for you! 🙂

Did you like the article? Please take a minute to share it on Twitter. 🙂

#### About Vasilis Vryniotis

My name is Vasilis Vryniotis. I’m a Data Scientist, a Software Engineer, author of Datumbox Machine Learning Framework and a proud geek. Learn more

# IoT: Is It a Technological Revolution or A curse?

Published

on

All the things around us are getting smarter and network ready. We are increasingly becoming the citizens of a digitally connected world where things interact with humans to make life easier.

From the farmhouse where a farmer can keep track of plant’s watering through a connected sprinkler to the related coffee machine that just prepares your coffee just when you get up and brush your teeth, connected reality has penetrated every nook and corner of everyday life.

“ Apparently, this is a luxury to get things done quickly and in time without the least efforts. Making things happen without moving our limbs is smart and cool.”

But at the same time, these smart manoeuvres make us dependent on gadgets, and over time, this takes a toll on our physical and psychic health. So the smart reality of IoT is not so wise as it seems, especially when you consider the lifestyle effects on health.

Considering both sides of the coin here, we have decided to compare IoT’s good and bad. Let’s begin with the challenges and opportunities before going into the pros and cons of IoT.

### Key Challenges for IoT

As long as two devices and apps are connected over the web to allow users a lot of practical benefits of automation, IoT is great. The connected reality of IoT will continue to proliferate and prosper in the years to come.

But this prosperity and growth of IoT are not possible without challenges. Let us have a quick look at some of the biggest challenges for IoT.

• Data security challenges and lack of data privacy are two major challenges. Some security issues and threats like Denial of Service (DoS) are also cropping up as a major security challenge.
• Connected medical devices and gadgets in banking, healthcare, insurance, and several sectors need to conform to industry regulations and norms. Many IoT devices fail to adhere to these regulatory frameworks.
• Faster network connectivity and quick access to the data is still a key challenge for IoT devices. The network created delay can lower the efficiency and effectiveness of IoT devices in different settings.
• Many fragmented devices and gadgets following no standard protocol and data architecture are adding to the problems. Lack of standards and protocols create security issues, performance glitches, and, above all, the trustworthiness of the solutions.
• The scalability of the devices to meet the increasing user footprints and user engagement is extremely important. Lack of scalability is a major problem for the IoT ecosystem.
• Less capable and outdated sensors that are still in use, such as sound, light, temperature, motion, colour, radar, laser scanner, echography, and x-ray, etc., often end up giving non-precise results. This is a big challenge for many IoT devices.

### Opportunities

In spite of all these challenges, IoT is always having the largest share of digital growth opportunities. As connected devices have penetrated our homes, workplaces, public transports, and vehicles, tons of user data are being produced every minute.

“IoT is responsible for turning data into gold mines of insight,” as Paul Osborne, CTO of Cerdonis Technologies LLC, put it, “IoT is everywhere, and thus it can deliver data from all facets.” This huge and exponentially growing data is rich in audience insights and can be utilized to target customers based on data-driven insights.

The huge volume of digital data now can be managed by leading technologies such as Blockchain and Big Data analytics. The increasing importance of IoT data for driving customer and user insights shows the unlocked potential of IoT.

### Pros of IoT

IoT is allowing remote access and control to devices to make life easier across all contexts. Let us have a quick look at the pros of IoT.

• Faster and instant access to various information through devices helps users to make better buying decisions.
• Thanks to devices’ connected ecosystem, workplace productivity, and personal time management can see a positive turnaround. With IoT led automation, people at home and workplace get things done quickly.
• Thanks to IoT, individuals have better and bigger control on different gadgets and digital solutions. This also opens up the scope of more personalization in the user experience of the apps, marketing, and other areas.

### Cons of IoT

Like every other technology, IoT, despite its advantages, has its dark sides. Here we shortlist some of the common and widely cited cons of IoT technology.

• Enhanced dependency on gadgets is continuing to make modern human beings lethargic, leading to many lifestyle disorders and complications. The device dependency is also making people more vulnerable to sudden failure of systems and processes.
• IoT or Internet of Things, representing a connected ecosystem of gadgets and applications, are often vulnerable to security attacks and potential data breaches as all connected gadgets do not follow a certain security protocol or standard. IoT gadgets are often cited as the source of major security issues.
• Though the role of automation in taking human jobs and reducing employment scope has already been refuted a number of times, still IoT-led automation is cited by many as the emerging threat to the human workforce. Well, the contrary argument always thinks IoT will take care of mundane tasks so that the human workforce can concentrate on more important decision-making tasks.

Conclusion

The Internet of Things is here to stay and prosper. With IoT, humans’ ultimate automation dream has almost become a fully-fledged reality that you can interpret as revolution or curse depending on your perspective.

# 7 Awe Inspiring AI Techs That Transformed The Digital World

Published

on

For many people worldwide, artificial intelligence is slowly making its way into their lives without fussing. From our cars, homes, mobile phones, and our workplace, Artificial Intelligence is everywhere.

Apart from our personal lives, Artificial Intelligence has also made its way into various industries such as automotive, e-commerce, healthcare, and entertainment.

To better understand artificial intelligence’s impact on the digital world, we first need to know what it is. To sum up,

“Artificial intelligence reduces human intervention with the help of algorithms and tools that provide recommendations, predictions, and decisions through real-time data.”

Now that we know what artificial intelligence is, we can move forward and find out how it transforms the digital world. The use of artificial intelligence is every present and visible in our daily lives.

With the help of a machine and deep learning, artificial intelligence has found its way in computer vision systems, image processing, and voice recognition applications, transforming them in a way never seen before. If you want to know how Artificial Intelligence affects the digital world, this article will help you. Listed below are some of the applications of artificial intelligence in today’s digital world:

### Computer Vision Systems

Computer vision analyzes data by using different images that show various objects of interest. It uses deep learning and image processing to recognize patterns and then provides predictions autonomously.

From simple everyday applications such as recognizing human faces to complicated ones such as detecting obstacles when driving autonomous vehicles, computer vision helps AI-enabled technologies and devices to perform their tasks more effectively.

An example of how AI affects computer vision systems is through its use in machine vision systems. A sub-field of computer vision systems, machine vision systems finds their use in automotive applications, such as detecting stop signs, detecting obstacles, etc. Machine vision technology reduces distractions and enables the driver to stay alert while driving.

Creating and Generating Online Content

Who wouldn’t want a machine that writes online content by itself? Although AI cannot write about their opinion for a political blog or its views about new emerging technologies, it certainly can create content for your website that can help attract an audience from every part of the world. It can also help you save money, resources, and a lot of time. You only need to feed it data that it can understand and learn, and it will take care of the rest.

Wordsmith and quill are examples of such programs, which companies such as Forbes and Associated Press use to create new and fresh content for them, leading to numerous visits on their websites. With the use of templates and keywords, these programs generate content readers feel that humans wrote it.

Curating Online Content

AI-based programs not only allow you to create content, but they also help you curate it. It enables visitors to interact with web pages in a better way, only showing them the content they want to see. It helps in providing visitors with more personalized user experience. For example, if you add a product to your shopping cart on Amazon, you will see suggestions relevant to your choice.

“Another example is Netflix. If you watch a movie or a drama serial on it, with the help of AI, Netflix provides you with relevant movie and drama suggestions that piques your interest.”

From a marketing perspective, imagine showing visitors the content they wish to see. With the help of deep learning and machine learning, you will surely increase your daily clicks.

### Email Marketing

Emphasizing user behavior and preferences, companies use AI-based marketing campaigns to make it easier to connect with potential clients. With the help of machine learning, companies can analyze trillions of megabytes of data to find out the time of day to engage with potential clients, what type of content to show them, the email titles and subjects that generate the most clicks, and its frequency.

Wouldn’t you want to know all these so you can save time, money, and effort? Some of the examples of such AI-based email marketing include Persado, Boomtrain, and Phrasee. It will transform how you perceive email marketing and allow you to generate tons of clicks, increasing your online presence.

Gone are the days of posting advertisements in the newspaper or the local radio channel. Artificial intelligence has made it easy for companies to find an audience that will be more prone to finding an interest in an advert. A sub-field of digital marketing, digital advertising sees the most benefits when adopting Artificial Intelligence.

“For example, Google Ads and Facebook Ads use Artificial Intelligence and machine learning to find people that will most likely have an interest in your Digital Adverts.”

With the help of AI, both these platforms analyze user information such as demographics and interests to detect users that suit a company’s advertisements.

### Website Design

If you think that a great website cannot exist without the help of a coder or a programmer, then we have news for you. Nowadays, various AI-aided website design programs exist that can easily design a website with the help of images, call to actions, and text provided by the user.

And all that without any need of a programmer or a website designer.It allows companies to save money and makes their website look like someone with a college degree designed it.

### Artificial Intelligence Chatbots

Nowadays, brands usually communicate with their potential clients through Facebook messenger, WhatsApp, and other online communication platforms. As everybody already uses these platforms, it provides companies with a quick way to send the word out about their brand. Such a medium of communication leads to a requirement for faster responses. That is only possible through AI aided chatbots.

Chatbots are also available 24/7, which is not possible for a human being. For example, a big brand like Sephora uses chatbots to provide visitors with recommendations and make-up advice, depending on their interests, and without human intervention.

Final words
As you can see, artificial intelligence in the digital world provides numerous benefits, whether in marketing, advertising, or providing a great user experience to a customer. Also, to clarify, Artificial Intelligence is not here to replace human beings, but it helps them perform their task more effectively and efficiently.

However, for something like this to happen, they must give Artificial Intelligence a chance. Otherwise, they risk facing the inevitable.

# AI and Machine Learning Technologies Are On the Rise Globally, with Governments Launching Initiatives to Support Adoption: Report

Published

on

Kate MacDonald, New Zealand Government Fellow at the World Economic Forum, and Lofred Madzou, Project Lead, AI and Machine Learning at the World Economic Forum have published a report that explains how AI can benefit everyone.

According to MacDonald and Madzou, artificial intelligence can improve the daily lives of just about everyone, however, we still need to address issues such as accuracy of AI applications, the degree of human control, transparency, bias and various privacy issues. The use of AI also needs to be “carefully and ethically managed,” MacDonald and Madzou recommend.

As mentioned in a blog post by MacDonald and Madzou:

“One way to [ensure ethical practice in AI] is to set up a national ‘Centre for Excellence’ to champion the ethical use of AI and help roll out training and awareness raising. A number of countries already have centres of excellence – those which don’t, should.”

The blog further notes:

“AI can be used to enhance the accuracy and efficiency of decision-making and to improve lives through new apps and services. It can be used to solve some of the thorny policy problems of climate change, infrastructure and healthcare. It is no surprise that governments are therefore looking at ways to build AI expertise and understanding, both within the public sector but also within the wider community.”

As noted by MacDonald and Madzou, the UK has established many “Office for AI” centers, which aim to support the responsible adoption of AI technologies for the benefit of everyone. These UK based centers ensure that AI is safe through proper governance, strong ethical foundations and “understanding of key issues such as the future of work.”

The work environment is changing rapidly, especially since the COVID-19 outbreak. Many people are now working remotely and Fintech companies have managed to raise a lot of capital to launch special services for professionals who may reside in a different jurisdiction than their employer. This can make it challenging for HR departments to take care of taxes, compliance, and other routine work procedures. That’s why companies have developed remote working solutions to support companies during these challenging times.

Many firms might now require advanced cybersecurity solutions that also depend on various AI and machine learning algorithms.

The blog post notes:

“AI Singapore is bringing together all Singapore-based research institutions and the AI ecosystem start-ups and companies to ‘catalyze, synergize and boost’ Singapore’s capability to power its digital economy. Its objective is to use AI to address major challenges currently affecting society and industry.”

As covered recently, AI and machine learning (ML) algorithms are increasingly being used to identify fraudulent transactions.

As reported in August 2020, the Hong Kong Institute for Monetary and Financial Research (HKIMR), the research segment of the Hong Kong Academy of Finance (AoF), had published a report on AI and banking. Entitled “Artificial Intelligence in Banking: The Changing Landscape in Compliance and Supervision,” the report seeks to provide insights on the long-term development strategy and direction of Hong Kong’s financial industry.

In Hong Kong, the use of AI in the banking industry is said to be expanding including “front-line businesses, risk management, and back-office operations.” The tech is poised to tackle tasks like credit assessments and fraud detection. As well, banks are using AI to better serve their customers.

Policymakers are also exploring the use of AI in improving compliance (Regtech) and supervisory operations (Suptech), something that is anticipated to be mutually beneficial to banks and regulators as it can lower the burden on the financial institution while streamlining the regulator process.

The blog by MacDonald and Madzou also mentions that India has established a Centre of Excellence in AI to enhance the delivery of AI government e-services. The blog noted that the Centre will serve as “a platform for innovation and act as a gateway to test and develop solutions and build capacity across government departments.”

The blog post added that Canada is notably the world’s first country to introduce a National AI Strategy, and to also establish various centers of excellence in AI research and innovation at local universities. The blog further states that “this investment in academics and researchers has built on Canada’s reputation as a leading AI research hub.”

MacDonald and Madzou also mentioned that Malta has launched the Malta Digital Innovation Authority, which serves as a regulatory body that handles governmental policies that focus on positioning Malta as a centre of excellence and innovation in digital technologies. The island country’s Innovation Authority is responsible for establishing and enforcing relevant standards while taking appropriate measures to ensure consumer protection.