A quick lap around Algorithmia, the online algorithm marketplace

Published 4/20/2016 6:55:00 AM
Filed under Machine Learning

elling algorithms is becoming a thing on the internet. A number of big companies
have started to sell access to their algorithms. It's an interesting business model.
If you haven't got the smarts to implement an intelligent algorithm yourself, then buying
one from Microsoft or Google looks like a really smart plan.

I'm not going to say that you will end up with a great solution. You still need to spend
time to tune and integrate everything into a working solution, but it's a great start.

Talking about selling algorithms, a while back I found Algorithmia, a website which
provides an online marketplace for people to buy and sell algorithms of the kind that
Microsoft and Google are providing through their own cloud.

It is an interesting service, which deserves another look.

What is algorithmia?

According to the website Algorithmia allows you to implement any algorithm
in 5 lines of code (Approximately of course).

Bring [algorithm] to your app with less than 5 lines of code.

Algorithmia provides hosting for people to publish their algorithms. All algorithms
implement the same interface so that you can access them through the algorithmia API client.

To get started you create a new account on algorithmia, which gives you access to the algorithms.
You get an API key from the website which you can use to call the various algorithms available.
The next step is to write a few lines of code to invoke the algorithm of your choice:

import com.algorithmia.*;
import com.algorithmia.algo.*;

String input = "\"YOUR_NAME\"";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://demo/Hello/0.1.1");
AlgoResponse result = algo.pipeJson(input);
System.out.println(result.asJsonString());

This looks easy enough to get going. By the way, Java isn't the only language supported
by the website. You can use Python, Scala, Javascript and many other languages.
The Algorithmia client API is a wrapper around a HTTP POST call to the website.
So if your framework supports HTTP (which all frameworks/programming environments do these days)
then you are set to use Algorithmia.

Please be aware, algorithmia is not free. You have to pay for every call you make.
You get 5K credits for free to get you started, but after that you have to pay.
10K credits cost you 1 dollar.

You pay a minimum of one credit per call + 1 credit per second it takes for the call to complete.
Which means that large volume applications that use slow algorithms are more expensive.

What about publishing algorithms on Algorithmia?

Of course a marketplace needs both buyers and sellers. You can publish your own algorithms on
Algorithmia.

When you publish an algorithm on the website you can ask a royalty fee or provide access
to your algorithm for free. The user has to pay the one credit fee to algorithmia, the royalties
are for you to keep. The website pays you through paypal secure payout.

The fact that you can ask money for the algorithm you wrote makes it interesting for businesses.
Don't expect to make a mountain of money though, because on average people ask about 2-4 credits
in royalties. Which comes down to 0.0002 - 0.0004 cents per request. Not very interesting if your
algorithm is used by only 5 people to 10 people once a week.

However if you write a good algorithm, which is used by 100 applications and receives about 2.5 milion
calls per month then it becomes interesting. There are algorithms on the marketplace that generate an interesting
amount of traffic to them.

Taking a closer look, how to publish an algorithm

So how does this work in practice? When you want to publish an algorithm, you select the Add algorithm
button on the profile dropdown. Next you give the algorithm a name and enter some other metadata.

Create a new algorithm on Algorithmia

When you click the create button you get an online IDE in which you can write your algorithm in one
of the supported languages. Right now Scala, Java and Python are supported.

It is important to note that you can edit your algorithm in the online editor only!
This means a couple of things:

If you have an existing algorithm, you will need to port it to Algorithmia.
Not an easy task if your algorithm contains a few thousands lines of code.

Also, there's limited control over how and where your algorithm runs. To give you an idea why this is a problem:
the autotagger algorithm in knowNow is optimized to run very fast, because we cache certain models we use.
You have no way to control this behavior in Algorithmia, which leads to loss of performance.

Right now the online editor only supports a single file. In practice this means that when you want
to write your algorithm in Java you need to work with inner classes. You cannot have multiple classes
in a single Java file. In Scala and Python this becomes less of a problem, since both languages support
multiple classes per file.

A quick heads up! It turns out that the editor does support multiple files.
But it is sort of a hidden feature. There's a slight bulge on the left of the page. Click that to get the file
explorer. I was told by Diego Oppenheimer from Algorithmia that the usability problem with the file explorer being fixed ASAP. So if you can't find it,
don't worry you will in the near future!

Edit your algorithm in the online editor

Because you can only use one file, you will find that writing a more complex algorithm becomes rather hard.
It's not very maintainable. The only solution left is to write a separate library, publish it on maven and
use that from the Algorithmia editor instead through the dependencies.

Finally there's one other thing that I think is worth mentioning. If you use machine learning than you will
find that algorithmia is even less friendly. The runtime does not scale to handle large volumes of data quickly.
Yes you can train a model and store it in the data collection of the user, but, the bigger the data, the longer
it will take. It's not like you have a Spark cluster available, so things will take a while.

In short, the good, the bad and the ugly

In conclusion, Algorithmia is a neat idea. There is a need for ready-made algorithms that you can
buy and use within minutes. The website provides a great solution for users of algorithms.

The website does leave a lot to be desired for creators of algorithms. The editor basically sucks. Writing a complex algorithm on Algorithmia
is a real pain since the editor forces you to write unmaintainable code. It's something I simply can't live with anymore in 2016.

I think it would be a lot better if they provided git repositories and an integrated build service. This
enables developers to write more complex and better algorithms. Also, it would be great to have more control
over how the algorithm runs within the runtime.

So should you use it? Yes, if you are searching for commonly available algorithms.
I would hold off for now if you're a developer until they provide a better solution for editing algorithms.
The team is working on GIT support, so the issue with writing algorithms will be solved. So keep calm and copy + paste.

Resources

Want to try Algorithmia yourself? Here's a few useful links to get you started.