Announcing simdfied, an open-source Machine Learning library, utilizing SIMD

· Algorithms, Machine Learning, Open Source, SIMD
Authors

Lately I’ve been working on simdfied – a Machine Learning javascript library, utilizing SIMD!

simdfied

Earlier this year, Intel announced their collaboration with Google and Mozilla, enabling a preview native SIMD support for firefox-nightly and chromium browsers;  they provided some really nice stats for gaming implementations.

For me it was time for an idea I’ve had for a while; implementing a javascript machine learning library to be used directly in the user-agent, with a zero-server paradigm.

Traditionally there were 2 major issues with this approach (and they’re related):

  1. Performance of complex matrix operations over single-threaded scripting technology
  2. Direct access to files usually meant uploading them to a server, breaking the concept of a pure client side app, not to mention the irrelevant latency of big data files upload

simdfied utilizes the preview SIMD support for vectorizing its ML matrix operations. Combined with latest HTML5 multi-threading and file capabilities it gets closer to closing the gap with traditional desktop ML software.

Check out MLplayground, it’s powered by simdfied and let’s you drag and test your csv or matlab files directly in your browser!

MLplayground_linear_regression

simdfied and MLplayground are a work in progress, and currently cover linear regression, logical regression and k-means.
Any feedback would be appreciated; you’re welcome to contribute, fork and “star” on github 🙂

———————————————————————————————-

A simple inline example for house prices prediction, using linear regression:

//load our X matrix with 2 features: square footage and number of bedrooms
var X = simdfied.mat().from2dArray([[645, 860, 1000, 1300, 1400], [2, 3, 3, 4, 5]]);


//load our y vector with house prices
var y = simdfied.vec().fromArray([250000, 350000, 400000, 550000, 700000]);


//run and predict a price for a 3 bedroom, 900 square footage house:
var ml = simdfied.ml().algo("linReg").X(X).y(y).set("iter", 1500);
ml.run(function(ml){ ml.predOne([900, 3]); });


> running linear regression
> normalization done (4ms)
> initial cost: 113,750,000,000.00
> gradientDescent done (209ms)
> cost after #1501 iterations 154,786,244.34
> predicting for features [900,3] the value of 380,217.40

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: