What's an Algorithm?

What's an Algorithm?

To a programmer, an algorithm is a concrete series of steps used to solve a problem.


Here at Algorithmia, the term “Algorithm” refers to a supercharged Serverless Function, optimized for Machine Learning.


It is the basic building block of our system: a piece of abstract code which can be run anytime, from anywhere, and scales automatically. It can access GPUs, is language and framework agnostic, has automatic API wrappers, built-in versioning, pipelining, and a dozen other features which make it ideal for running anything from simple utility code to large ML models.


Writing your own Algorithms


At its core, an Algorithm is simply a piece of code that you create, in whichever language you prefer. There are almost no restrictions of what sort of code you can write, and we support importing any dependencies you need. The only mandatory part is that your Algorithm must have a function called “apply()” -- this is where execution begins when somebody runs your Algorithm. The rest of the code is up to you: import any libraries you like, write any functions you need.


Once you’re done writing code, you’ll Publish your algorithm, either privately (so only you can find & run it), or publicly (which gives other people the ability to execute your code, but not to see or download it unless you want them to). You’ll also pick some settings (such as whether your code needs GPUs, or is allowed to access the internet), and write a little bit of documentation (just a line describing its purpose, and possibly a few usage examples).


Once published, we create a homepage for your function where other people can find it (if public), test it out by entering some input right there in the page, and copy code snippets in whichever language they are working in (regardless of the language you actually wrote it in).


Using any publicly-available Algorithm


Algorithmia isn’t just a place to run your own code; it is a place where developers across the globe share their creations with each other. Even if you don’t publish any Algorithms of your own, you can still make use of the thousands of functions that other developers have written and published for general use.


Using Algorithms is a simple as calling a function, but you don’t need to install any heavyweight libraries, and they scale automatically without using up local resources.


To begin, search through the catalog to find an Algorithm that meets your needs -- perhaps a simple utility function like Url2Text, or a Machine Learning tool such as SentimentAnalysis or Image Colorization. Copy the sample code, in whichever language you prefer, and drop it into your own application or script: whenever this code is called, the Algorithm will be remotely executed for you, and the results invisibly piped back to your local app.


That’s it! If you're ready to keep learning, find out how to use Algorithms in your app or script, or jump straight into writing your own Algorithms.