All posts in Blog Posts

Algorithms for the Masses: Learn how to give your app super powers

image

Join Algorithmia on Monday, November 9th at 4pm for a discussion on the power of algorithms at Startup Hall, and how you can build next generation apps using machine learning, natural language processing, computer vision, and more. We’ll discuss how algorithms can power intelligent platforms, and create personal, context-aware interactions you can use to turn dumb data into smart applications. RSVP Here.

Event Details:

  • Price: Free
  • When: Monday, November 9, 2015 from 4:00 PM to 5:30 PM
  • Where: Startup Hall – 1100 Northeast Campus Parkway, #200

About Algorithmia:

Algorithmia is the largest marketplace for algorithms in the world, enabling developers to rapidly build and deploy production-ready, serverless applications in minutes. With Algorithmia you have access to world class algorithms in five lines of code or less. Leverage algorithms to recognize patterns in data, extract visual knowledge, understand audio, classify unstructured data, and derive meaning from language, all via a REST API.

How to Recommend Related Content in Just Three Lines of Code

Recommendation engines are all over the web – you’ll recognize them under the headings such as “More articles like this,” Amazon’s “Customers Who Bought This Item Also Bought,” or even the side bar of related videos on YouTube. Recommender systems help users discover content on your site that they might not have found otherwise and provide a powerful alternative to a search function.

Now you can bring recommendations to your site by harnessing Algorithmia Recommends, a content recommendation tool to suggest more of your own content and increase user engagement. Best of all? Anyone can do it with just three lines of code!

How Simple Is It?

Just plop these three lines of code into your website’s markup, insert your API key, and Algorithmia takes care of the rest.

The Code

<div class="algorithmia-recommends"></div>
<link rel="stylesheet" href="//algorithmia.com/assets/stylesheets/recommends.css">
<script src="//algorithmia.com/assets/javascripts/algorithmia-recommends.js" data-apikey="YOUR_API_KEY_HERE" data-uuid="82990285-9714-6349-c8ee-859414df1692" data-timelimit-months=24></script>

The above code is what you need to put Algorithmia Recommends on any site. The first line is the container, which the recommendations will render into, followed by a CSS stylesheet we’ve included to give it a nice layout. The last line includes the Algorithmia Recommends JavaScript in your page, and gives you a place to put your API key, as well as options for time-limiting the recommendations and a UUID field so that you can specify which pages are in-scope of the recommender.

Give it a try by pasting the code into your markup and replacing the API key, which you can get by signing up here. The first time the recommender is called it will take a few minutes as it crawls your site, and runs the algorithms. After that one-time process recommendations will be nearly instant.

Using WordPress or Drupal?

We’ve got plugins for both (WordPress, Drupal) to make the integration of Algorithmia Recommends even easier!

How The Recommender Works

Algorithmia Recommends uses the Breadth First Site Map web crawler algorithm and powerful natural language processing algorithms Keywords For Document Set and Keyword Set Similarity to find and categorize all the pages on your website in order to help your users find content that’s most relevant to their interests. Implementing a recommender on your site can increase engagement by helping users browse through content that already exists and encouraging them to stay longer on your site.

In addition to being able to specify a freshness constraint so that your users see recently published content, you can even filter out pages that are irrelevant, such as the homepage, about pages, or terms of service. The generated HTML and included CSS are customizable to fit in with your current design.

Try it today with just a few minutes of set up and head on over to the Algorithmia Recommends page to learn more about this powerful, easy-to-use tool!

Supercharging the Command Line: Using Smart Thumbnail to Batch Crop Photos

As much as I love building large, robust software systems and services, I often just want a quick script to solve a particular problem. In those instances I feel most comfortable dropping to the command line. With Algorithmia’s new CLI tool, I can quickly and easily access algorithms for a wide variety of tasks. With the entire Algorithmia marketplace readily available behind the command line interface, now it’s trivial to detect faces, make passport photos, encrypt messages, crawl a domain to build a site map, cheat at LetterPress or Sudoku, and much so more.

Recently I needed to convert a directory of images into thumbnails, with the goal of having each cropped to the same size without losing the focus on the face. While cropping a photo manually isn’t too bad if you just have to do it once, cropping a large set of photos by hand can be extremely time consuming and tedius. Lucikly, Algorithmia offers an algorithm to do just that: Smart Thumbnail.

The Algorithmia way

The Smart Thumbnail algorithm builds on the opencv-based Face Detection algorithm to detect faces and create thumbnails in one fell swoop. I started with this sample set of photos:

image

Combining the Smart Thumbnail algorithm with the Algorithmia CLI client, it’s simple to create a clean script for thumbnailing an entire directory:

#!/bin/bash
for image in $@; do
  echo "Processing $image"
  output_file="smart_thumbs/$(basename ${image%.*}).png"
  algo run opencv/SmartThumbnail -D "$image" -o "$output_file"
done

This short and simple code makes it easy to batch process photos, and the results speak for themselves.

image

As you can see, each image is cropped to the same size, but no one is left with a half a head or their face cut in two. Instead of having to manually crop each photo so that the faces are preserved, I can just run all the photos through the Smart Thumbnail algorithm. Not only is it the intuitive output I was hoping for, but it was also a simple CLI experience with just one clean tool.

One tool, any algorithm

With the Algorithmia CLI I now have a powerful set of algorithms available to me for use across any project or platform. With access to any algorithm in the marketplace, I can now reach for one tool to perform a variety of tasks. Sign up, install the CLI, pick an algorithm, run it with a simple:

algo run <algorithm> -d '<data>'
# or
algo run <algorithm> -D '<file>'

And enjoy your supercharged command line!

Let us @algorithmia know how you plan to use the Algorithmia CLI. Include #SuperchargedCLI and your Algorithmia username for 10,000 free credits.

Learn how to leverage powerful algorithms with Algorithmia and General Assembly Seattle

image

We’ve teamed up with General Assembly to produce a free, two-hour workshop designed to help web developers build brilliant apps using Algorithmia’s powerful platform. 

You’ll learn how to gain access to world class algorithms in five lines of code or less, allowing you to recognize patterns in your data, extract visual knowledge, understand audio, classify unstructured data, and derive meaning from language

If you’re in the Seattle area, and have an interest in giving your app super powers, then join us Wednesday, October 14 at 6:30pm! A basic understanding of APIs, and some Python or JS knowledge is required.

About This Workshop:

RSVP here. 

Wednesday, October 14
6:30 – 8:30 pm PDT

WeWork Seattle
500 Yale Avenue N
Seattle , WA 98109

Who’s Who: Facial Recognition Made Simple

Using machine learning from Algorithmia to train a model to recognize faces

image

Name That Actor is a minimal demo from Algorithmia to show how anyone can use a classic face recognition algorithm. In the box below, enter the URL to a photo of one of the actors from the TV show “Parks and Recreation” or click on one of the example images, which were not used in training the facial recognizer model. The algorithm will run the image input against the model to predict the name of the actor.

This demo is out-of-date. Please See blog.algorithmia.com/quickly-building-a-face-recognizer/ instead.

How we made it

Because Parks and Rec is a celebrated show (for good reason–we hope you agree!), we decided to use the main cast as the recognition model for the algorithm. To train the model, we used the Train Face Recognizer algorithm with a collection of images of the actors. 

We started by downloading 10 photos from Google Images of each actor playing the main characters:

  • Amy Poehler as Leslie Knope
  • Nick Offerman as Ron Swanson
  • Chris Pratt as Andy Dwyer
  • Aziz Ansari as Tom Haverford
  • Aubrey Plaza as April Ludgate
  • Adam Scott as Ben Wyatt
  • Rashida Jones as Ann Perkins
  • Retta as Donna Meagle
  • Jim O’Heir as Jerry Gergich (or Garry or Larry or…)

Using the Algorithmia API, we uploaded all the images to a data collection. Then we ran the Train Face Recognizer algorithm against the collection, providing the actor’s name for each photo, to train the model against the collection as a dataset. To analyze new images, we call the Recognize Faces algorithm which uses the trained model to predict the name of the actor.

Note: Our method for detecting and recognizing faces works best for frontal face images. Faces at a profile are harder to detect and recognize with the same level of accuracy. It also helps when the faces are reasonably large relative to the size of the image, a modest 1/64 of the size of the image in pixels. Read more about face recognition using Algorithmia here.