DEV Community

Cover image for Machine Learning APIs for Web Developers
Mark Michon for Bearer

Posted on • Originally published at blog.bearer.sh

Machine Learning APIs for Web Developers

Machine learning (ML) used to be a tool limited to specialized developers and dedicated teams. Now, thanks to many web service providers and approachable tooling, your applications can use pre-build learning models and machine learning techniques the same way you would use any web service API.

This is a quick way to test out and benefit from machine learning without having to invest in artificial intelligence, building your own learning models, or shaping your application around ML. In this article, we'll focus on:

What can you do with a machine learning API?

When we talk about artificial intelligence (AI) and machine learning (ML) in these contexts, they will sometimes be used interchangeably.

At a basic level, machine learning is the process of training a computer to understand the data it receives on a level deep enough to make decisions. Artificial intelligence is the decisions it makes and as a result, the decisions that your application uses.

All the big web services players are now involved. Microsoft Azure, Google Cloud, Amazon Web Services, and the IBM Cloud all provide similar products with a few unique exceptions. The types of services offered revolve around the types of learning and prediction that your app needs. They can help you do things like:

  • Focus on a specific part of an image the user uploads. Twitter, for example, crops image previews to center on text.
  • Provide recommendations based on purchase or browsing history.
  • Predict outcomes based on a set of inputs (forecasting).
  • Handle language processing to translate text and autocomplete sentences.
  • Provide conversation-style chat bots that can use sentiment analysis to better understand the customer.
  • Detect anomalies in your data by looking at past trends.

Many providers allow you a way to build upon existing machine learning models of specific types. This allows developers to feed the machine information, without the need to deeply understand how everything works.

For example, most APIs that provide computer vision or image recognition use a pre-built model that already knows what to look for in an image. They can detect common items like buildings, household objects, and animals.

Your team's developers then provide images to the machine learning prediction API in the programming language you prefer, and it uses the pre-built model to make a prediction. Similar techniques can be used for tracking movement, facial recognition, and text analysis.

The big players in ML APIs

When we talk about machine learning APIs, we are really talking about machine learning as a service (MLaaS). Rather than run the full stack of ML tooling yourself you rely on a provider to handle the processing and, to some extent, the training of the machine.

Many providers now offer similar services at competitive price points. For the most part, you can stick with your preferred provider, but there are a few instances where some offer a better solution.

Nearly every provider offers services like computer vision, facial recognition, text translation, and text-to-speech. Let's look at a brief overview of each provider, with a few of their services highlighted.

Amazon

Amazon has expanded Amazon Web Services (AWS) to include a variety of ML and ML-adjacent services. The Amazon machine learning APIs offer nice hooks into the AWS ecosystem.

Key offerings:

  • Recommendations: Their Amazon Personalize service gives you the power to use a recommendation system similar to Amazon's to offer "related content" style recommendations to your users. It uses your own dataset, and a simplified interface to creating and training models.
  • Transcription: One of the first to offer transcription services, Amazon Transcribe will let you transcribe recorded videos or even streams in near real-time.
  • Code review: Amazon CodeGuru is a newer offering that analyses your codebase and uses machine learning to alert you of expensive code and potentially problematic code. They use their own internal codebase and over 10,000 open source GitHub projects to train the machine learning models used by this API.

Amazon's pricing differs with each machine learning API and can be found on each APIs product page. You can see the full list of AWS' ML and AI-related offerings on the Machine Learning on AWS page.

In addition to their machine learning APIs, Amazon also offers solutions for teams looking to host and deploy their own learning processing and ML applications.

Google

Google's machine learning offerings are heavily focused on being a platform for hosting, training, and managing ML models. That said, they have begun to offer many more machine learning APIs for developers to take advantage of.

Some of the more interesting APIs are centered around Google's AI Building Blocks. These are similar to drop-in tools that can add AI and ML features to existing apps without the need for in-house expertise.

Key offerings:

Google offers a generous free tier for the majority of its machine learning and AI products. Developers that need more from the Google cloud can view their pricing information on an API by API basis.

Microsoft

Microsoft's cloud services offering, Microsoft Azure, groups its machine learning APIs under the title of Cognitive Services. With similar offerings to the other providers, services can be broken down into the key categories:

  • Vision: Focused around APIs related to object detection, classification, and recognition. These services can do things like detect faces, recognize documents, and train custom models to identify images.
  • Language: Just like most providers, Azure also offers translation, sentiment analysis, and natural language processing. Beyond this, they offer a few interesting APIs such as Immersive Reader, which adds additional information to text for learners.
  • Speech: Developers can access the Speech Service API to generate synthetic speech. A new offering that stands out amongst the other providers is Speaker Recognition. It allows developers to identify and verify speakers using existing data.
  • Decision: The decision APIs offer tools like recommendations, similar to Amazon's offering, but also provide Content Moderation and a new Anomaly Detection service. Anomaly detection analyses data to look for outliers over time.
  • Search: Utilizing the foundation of Microsoft's Bing search engine, this API falls under the cognitive services umbrella, even though many developers may not classify it as a machine learning API.

Like all of our providers in this list, Azure's pricing is on a usage basis. All services are managed from within the Azure Portal. See the breakdown for each API on their pricing page.

IBM

Often forgotten next to AWS, Google Cloud, and Azure, IBM's web service offerings are vast. All of their AI/ML APIs are grouped under the Watson brand. While many of their offerings are similar to the other providers, here are a few interesting differentiators:

  • DevOps insights: Like Azure's anomaly detection, IBM offers Watson AIOps to help developers resolve and detect incidents.
  • Automated Assistant: Watson's big sell is its Watson Assistant. It is an AI-powered chat interface for responding to customers. It works both as a text-chat on sites, but also on call systems to let users ask questions in natural language.

While the audience for IBM services tends to skew toward the enterprise, they offer generous free tiers for teams and developers looking to try out their services. See pricing for individual APIs on their pricing page.

ML and AI Startups offering APIs

The landscape of startups providing ML and AI APIs is a bit more volatile, with some going out of business after a few years. The big players dominate the space, but there are smaller startups and open source APIs that offer interesting takes on common features. These range from traditional web service APIs, to full software suites. Both traditional developers and learning developers alike will find value in services like language processing, image recognition, and more. Here are a few players in the space:

  • Kairos: Kairos offers a variety of services centered around facial recognition. Some of their features include face detection, verification, identification, tracking, and insights into facial features like age and gender.
  • TextRazor: A Natural Language Processing (NLP) API, TextRazor does more than attempt to understand the text. It works to provide additional meaning by pulling useful information from the text, like business names and places, to provide more information about the intent and meaning behind the text.
  • RxNLP: Another API that aims to provide value to text content, RxNLP has a few APIs that do things like comparing the similarity of text and group similar types of text.
  • Imagga: Imagga offers an array of image recognition services ranging from categorizing, automated cropping of key items, color extraction and modification, and even content moderation of inappropriate images.

More companies continue to spawn as the accessibility of ML and AI tooling increases. Expect to see startups targeted at specific industries to offer unique ML APIs in the future.

How should you choose a machine learning API?

As we look over the available APIs from the providers above, we can see that they all offer similar services. Unless you need one of the more edge-case offerings, it is often best to stick with the platform that you already use. This allows billing, management, and credentials to all exist in one place.

It is also important to consider maturity and performance. While large platform providers are more stable, they are still susceptible to downtime.

Always make sure to use a monitoring and remediation tool when utilizing third-party APIs.

At Bearer, we offer a tool to automatically detect anomalies, notify your team when problems happen, and even remediate API issues for your application. Check it out and get started for free.

Top comments (0)