Posts

Uber's Michelangelo vs. Netflix's Metaflow

  Uber's Michelangelo vs. Netflix's Metaflow Michelangelo Pain point Without michelangelo, each team at uber that uses ML (that’s all of them - every interaction with the ride or eats app involves ML) would need to build their own data pipelines, feature stores, training clusters, model storage, etc.  It would take each team copious amounts of time to maintain and improve their systems, and common patterns/best practices would be hard to learn.  In addition, the highest priority use cases (business critical, e.g. rider/driver matching) would themselves need to ensure they have enough compute/storage/engineering resources to operate (outages, scale peaks, etc.), which would results in organizational complexity and constant prioritization battles between managers/directors/etc. Solution Michelangelo provides a single platform that makes the most common and most business critical ML use cases simple and intuitive for builders to use, while still allowing self-serve extensibi...

Rails on heroku

Just found out that the new Rails 3.1.3 can be deployed to heroku using 'heroku create --stack cedar' instead of 'heroku create'.  By doing this, the only thing you have to change in the Gemfile is delete the line 'gem sqlite3' and add the following: group :development, :test do   gem 'sqlite3' end group :production do   gem 'pg' end then commit and push to heroku.

Deploying a Rails 3.1.1 app to heroku using Ruby 1.9.3 and Ubuntu 11.10

Hello friends. :P I (FINALLY) got a Rails app working on heroku!  But it took some doing - even the basic template rails app wouldn't work on heroku!  And the getting started walkthrough on the heroku website didn't tell me what to do about the errors.  I'm still not sure if it's my OS that makes this trickier than advertised, or if it's the version of Ruby or Rails that I'm using...or maybe it's heroku's problem?  Oh well.  But here's my setup, and if you've got the same then this tutorial should work for you.  This tutorial assumes you've already setup your heroku account. Operating System: Ubuntu 11.10 Ruby version : 1.9.3p0 Rails version : 3.1.1 Source control : Git  First off, if you haven't already, generate a stock app, and enter its directory : >rails new my_app >cd my_app Next, initialize a new Git repository, and add everything to it : >git init >git add . >git commit -am "Initial co...

Adapter Design Pattern

The adapter pattern is an extremely useful pattern for a few reasons. The reason I like it so much is because if you understand it, then you understand the concept of Dependency Inversion (the "D" in SOLID object-oriented design). Dependency Inversion is an object-oriented principle which states that in code, higher level modules should not depend on lower level modules. Instead, lower level modules should depend on higher level ones. Let's say you've got one higher level object that requires a lower level object to do it's job. But the lower-level object is likely to change or be swapped out for another. Here's the bad way to do it: namespace HigherLevelModule { public class HigherLevelObject { ...... public void Run() { LowerLevelObject obj = new LowerLevelObject(); string result = obj.GetSomething(); Console.WriteLine(result); } } } namespace LowerLevelMod...

Command Design Pattern

Image
The command pattern is best used when you have a command that must be executed by one object, while another object has the responsibility of deciding WHEN that command will be executed. The three entities associated with the command pattern are: client : the object that CREATES the command object and assigns it's receiver receiver : the object that HAS the method that will be run invoker : the object that DECIDES WHEN the command will be run Now let's look at an example. You have an IDE, and the 'undo' command is extremely important. Every action that is performed on the IDE has a method called undo() on it. But the actions have to be stored somewhere after they perform their task though, so that it's possible to call the undo() methods later, right? The solution is to push each action onto a stack when it's run, and register a listener for the 'undo' keyboard-combination/menu-item. The listener will pop() the stack, and invoke the popped ac...

Flyweight Design Pattern

So you have a group of objects that can be reused, but each time you use one you have to create it first. The problem is that instantiating these types of objects is expensive, and you don't want to instantiate the same kind every time you need it. Enter Flyweight design pattern. With this pattern, the trick is to create a new object only when you've never created that same type of object before - if you HAVE created it before, then simply look it up and use the one that's already instantiated. Here's some code: public class Flyweight { public static Dictionary _Table = new Dictionary (); public ISomething GetSomething(int key) { ISomething something; if(_Table.TryGetValue(key, ref something)) { return something; } else { something = new Something(key); _Table.Add(key, something); return something; } } } What this code does is ensure that t...

Factory Design Pattern

Image
The factory pattern is used when you want to separate the creation of objects from where they'll be used. For example, say you have one object that must get a Triangle object and draw it on screen. It doesn't care about what the triangle's state is, just that it has a void Draw() method. Suppose further that you have many types of triangles, and they can all be 'drawn' onscreen. In order to separate the creation of triangle objects from the caller, we would use the Factory Design Pattern: 1.) Create an interface called ITriangle, with one method : void Draw() 2.) Have all types of Triangle implement ITriangle. 3.) Create an interface called ITriangleFactory with 1 method: ITriangle GetTriangle() 4.) Create a concrete 'factory' class for each type of Triangle, each of which implements ITriangleFactory, and returns a new instance of their respective triangle in their implementations of GetTriangle()...since each Triangle type implements ITriangle, ...

Coding Fun

Image
I was coding at work the other day and was having a great time. Things were moving fast, and no roadblocks were coming up. Then I asked myself : what's the difference between what I'm doing now and what I'm doing when I do when I'm not enjoying a coding session (other than the fact that I had no major roadblocks appearing)? The answer was pretty clear. I was writing tests first! It wasn't always easy; often it's difficult to think about how I should test a certain functionality when I haven't even designed a solution or written the method or section of code...but it usually pays off afterwards, when I know exactly what is required by the caller/user (should be in the test) and I've already come up with an interface for the functionality (designed by writing the test). After that, all that's left for me to worry about is solving the problem and turning that nasty red 'test failure' light to a bright, tangy green. Just the fact that green...