cover-img

A lightweight AutoML tool: FLAML

11 December, 2022

5

5

0

Overview

I have explained AutoML in one of my previous blogs. Do check it out before reading this one, find the link below 👇
In today's blog, we will learn about a lightweight & open source auto ml tool - FLAML
Also, apply it to some basic machine learning problems such as regression & classification and check how it performs. So, let's get started! 🚀

What is FLAML?

FLAML is a lightweight Python library that finds accurate machine-learning models automatically, efficiently, and economically. It frees users from selecting learners and hyperparameters for each learner. It can also be used to tune generic hyperparameters for MLOps workflows, pipelines, mathematical/statistical models, algorithms, computing experiments, software configurations, and so on.

Keynotes

For common machine learning tasks like classification and regression, it quickly finds quality models for user-provided data with low computational resources. It supports both classical machine learning models and deep neural networks.

It is easy to customize or extend. Users can find their desired customizability from a smooth range: minimal customization (computational resource budget), medium customization (e.g., scikit-style learner, search space, and metric), or full customization (arbitrary training and evaluation code).

It supports fast automatic tuning, capable of handling complex constraints/guidance/early stopping. FLAML is powered by a new, cost-effective hyperparameter optimization and learner selection method invented by Microsoft Research.

Why should we use FLAML?

Look, machine learning isn't a simple task. It requires a lot of time and resources to train a model. But what if I said to you that the model can train itself without having to bother about different cases & combinations?
yes, you heard right! with the help of AutoML libraries you can basically automate the model training and model optimization parts. Hence the model itself generates a series of results through the training and selects the best amongst them. This is known as Auto Modeling.
There are a lot of algorithms and one can't try out all one by one manually geez. But with the help of FLAML, you can do that. Let the auto ml library do the model selection part for you. It will pick the best model after going though some predefined number of epochs by setting up some configs.

Benefits of FLAML:

Lightweight & open source library

Saves time and computational power

Automatic hyperparameter tuning

Automatic model selection with best params

Trains both classification as well regression well
Now that we know the benefits of FLAML let's try out some basic regression and classification ML problems.

Installation of FLAML

Python

FLAML requires 
Python version >= 3.7. It can be installed from pip:
use the first command while installing in the local python environment
use the second command while installing in Jupyter notebook or google collab
you can find more about the FLAML package from the official PyPI site 👇

Tutorials on FLAML

So we will be doing some hands-on training with FLAML to check out how easy it is to implement machine learning problems with AutoML.

Regression with FLAML

Let's work on a regression model with FLAML. we will be working on the house price prediction problem.

Import FLAML

Load the dataset

Initialize an auto ml instance with goal & settings

Train the model using automl

img

Model selection by FLAML

Predict using FLAML

img

Model optimization and output

Best model generation

img

Best model selected by FLAML

Classification with FLAML

Let's work on a classification model with FLAML. we will be working on the IRIS classification problem.

Import FLAML

Load the dataset

Initialize an auto ml instance with goal & settings

Train the model using automl

img

Model selection using FLAML

Predict using FLAML

img

Computing the best results from the model

Best model generation

img

Hyperparam tuning best model selected

That's it! See how ridiculously easy it is to build models with FLAML 🚀
So, this is how we can create rapid machine-learning models by using AutoML. It helps to reduce the time taken to compute the predictions and eases down the work of data scientists & analysts. Hence, it is growing at a steady rate and is accepted by a lot of companies building their product in the Machine learning domain.
Now it's your turn, go and build some machine learning models with FLAML and leverage the power of AutoML💻
Thanks for reading ❤️

tutorial

develevate

machinelearning

automl

5

5

0

tutorial

develevate

machinelearning

automl

Prathik Shetty
Code, coffee and community🚀

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.