Machine Learning in One Line of Code
What is Libra?
Libra is a machine learning API that lets you build and deploy models in just one line of code. It combines the power of modern machine learning libraries to create an all inclusive experience. Skip to the getting started section to begin working.
Recent explosion of frameworks
The last couple of years has brought with it hundreds of frameworks to help democratize the power of machine learning. But recently, I asked myself the question whether it has really accomplished that? TensorFlow and PyTorch, admittedly, require hours of study, and pre-existing autoML platforms aren’t beginner friendly.
These frameworks are written to help experienced engineers implement models quickly, but they still don’t help the non-technical user.
Noticing this necessity, with a team of 13 engineers, I created Libra. Around 5 months, and 200,000 lines of code later we released version 1.0.0 for the public!
Understanding the Libra API
We’ve combined the power of the most popular machine learning frameworks, PyTorch, TensorFlow, Keras, and Scikit-Learn, to create an all-inclusive API that represents modern machine learning.
The API’s fundamental building block is queries. These represents tasks that you want to be completed. For example a neural_network_query()
will build and return statistics for your data trained on a feed-forward artificial neural network.
With Libra, a machine learning model can be built in 1 line of code. We’ve fully automated data preprocessing, modeling, hyperparameter tuning, and evaluation into our queries.
Getting Started
We recommend using Google Collaboratory if you’re new to this space. Just open a new notebook and follow along.
Start by installing the library by running pip install libra
. If you don’t have Python or Pip installed you’ll need to get that first.
Now, it’s time to choose a dataset. To follow along with this tutorial you can use the California Housing Dataset. If you’re working on Collab you’ll need to upload it to your runtime (you can install by doing !pip install libra).
To get everything you need to use libra, just type this at the top of your file: from libra import client
. This imports an object that has all of the queries and helper functions for you to use.
Working with the API
The core of Libra is the client
object. client.models
is where all of the information generated by your queries is stored.
To get started, lets create a regression neural network to estimate the median house value, which corresponds to the column median_house_value
in the housing dataset.
First, we initialize a client object to store our information. Generally a new object is created everytime you’re working with a new dataset. We pass the path to the dataset as a parameter to the client.
new_client = client('housing.csv')
Then we perform modeling! We pass an english language instruction to the query, representing what we want it todo.
new_client.neural_network_query('Accurately estimate the median value of houses.')
You should see a process logger that documents everything the library is doing.
And that’s it!
We can now check out everything that we’ve generated by calling:
new_client.info()
As you can see, we’ve generated trained the model fully, generated plots, and calculated metrics. We just completed the whole end-to-end machine learning pipeline!
And, that’s it! You’re done. This is just one and of the hundreds options you have with Libra. Check us out for more at https://github.com/Palashio/libra.