Top 20 Machine Learning Frameworks You Must Know
As we ace through various concepts and important pointers to note in ML, we can discuss what are the best Machine Learning frameworks to work. We have learned various types of learnings and understood several concepts with the help of certain examples and especially various coding samples. So, for this article, we will learn about various frameworks and tools that are highly used across the field of ML and deep learning. This would be helpful, as it would help us to understand more about those tools and help to learn their better usage.
We will try to do a comparison between frameworks that could work for similar scenarios. If any, we would try to include the initial coding of how to import certain libraries. In addition to that, a mention of frameworks under research will also have a place in the last.
Keeping you updated with latest technology trends, Join TechVidvan on Telegram
List of the frameworks used in ML
There are certain frameworks that work for ML only. Here is a list of some known frameworks:
Scikit-Learn is one of the most popular frameworks for ML that has it’s roots in python language. It is very robust and provides a large variety of different libraries for performing certain tasks. It helps to run several ML models on classification, regression, dimensionality reduction, clustering, preprocessing, etc. The library Scikit-Learn is built on top of three python libraries that are Numpy, Scipy, and Matplotlib.
Before using this library, we must be thorough with the basic python libraries like Numpy, Scipy, Pandas, and Matplotlib, etc. We can install this library in our system using either ‘pip’ or ‘conda’.
Scikit-Learn provides a model selection option for different types of algorithms. It has pre-made models for classification, clustering, etc. In addition, Scikit-Learn also provides datasets, preprocessing, feature selection, etc. Each of these mentioned aspects, which the Scikit-Learn framework provides, all have specific libraries for them. So, the basic syntax would look like this:
Import matplotlib.pyplot as plt Import NumPy as np Import pandas as pd From Sklearn import datasets, SVM, metrics From sklearn.model_selection import train_test_split
For the above-mentioned credentials, it would look like:
From sklearn.datasets import #specific libraries
From sklearn.feature_selection import #specific libraries
#specific libraries here means there are many libraries for one technique, so only specific libraries are to be selected for certain models.
Note:- sklearn is Scikit-learn and the words coming after ‘sklearn.’ are also known as base. All of the syntaxes of Scikit-learn come under base class and other utility functions.
This is similar to Scikit-Learn and many of the libraries and functions are compatible with Scikit-Learn. But, it’s the main role is to provide better models and libraries exclusively for decision trees and forests. It has various special models that prove to be good for complex tree structures. Also, the benefit is the estimators of Scikit-garden are also good replacements for Scikit-learn’s trees and forests. The estimators are the functions that come after the base class.
The syntax is:
From sklearn.utils.multiclass import #specific libraries
Here multiclass is the estimator as it comes after the base class, which is sklearn.utils.
This is possible because both belong to the same framework and are meant to be compatible with each other.
Platforms like anaconda provide proper installation for these libraries, but you can also install them on command prompt using pip command.
NumPy, scipy, Scikit-learn, and python are the base of Scikit-garden. It provides some popular models like ModrianForestRegressor, RandomForestQuantileRegressor, etc.
The syntax for this is similar to sklearn, but here some terms would change:
From sklearn import #something
From skgarden import #model name or any other stuff
As the name suggests, auto-sklearn is another type of Scikit-learn framework. But, this framework is a bit different than the others when it comes to automated work. It is preferable to use because it is much quicker than a normal sklearn library when it comes to finding a suitable algorithm for your dataset. It is the perfect replacement for Scikit-learn classifiers.
Auto-sklearn provides inventive supervised ML. It helps us to find the most suitable model or algorithm for a completely new dataset and by optimizing its parameters. This pulls out a lot of burden from the developer and saves the person from hectic manual work.
This framework extends the ideology of the Auto-Weka framework. Auto-Weka focusses on combining the ML framework with a good level of optimization. Auto-sklearn tries to take it a step further, by building an ensemble or a combined network of different ML models tested previously during the optimization process. This ensemble covers many problems and saves a lot of time. If you had to test each model individually, it would take ages.
But, an ensemble would make the job a lot easier by selecting the model based on the dataset pattern. How does that happen? How can the framework help select models based on dataset patterns? Well, the answer is that this framework uses meta-data for model selection. In the testing process, it stores the model selection information as meta-data and if a similar pattern of dataset occurs, it then deploys the particular model.
Auto-sklearn is a congregation of nearly 15 classification and 14 feature-preprocessing based algorithms. It is open-source and based on the python language. The syntax would be:
Import autosklearn.classification Ab = autosklearn.classification.AutoSklearnClassifier() Ab.fit(a_train, b_train) Prediction = Ab.predict(a_test)
Probably one of the most famous C++ based ML frameworks in the market. C++ is a very vast and advanced language for programming. Creating a framework for ML using C++ requires a lot of in-depth knowledge. Even though the language is C++, it offers an interface for several languages and platforms like MATLAB, Python, R octave, JAVA, etc. It is popular for the range of ML models it offers. It’s models range from SVM to Markov’s model etc.
Also, due to its wide offering of models with a strong language base like C++, it is highly research-oriented. Many IT industries working on ML projects also use shogun. Shogun provides models and algorithms for nearly all types of learning methods in ML and to an extent, it helps in neural networks as well.
In the shogun framework, we would get libraries like CLIBSVM, etc. Every name will have a capital C in front of it.
Just like shogun, it is also a framework, which provides models. But this framework is based on JAVA. Also, Weka is a tried and tested platform for ML models. Here, we can get assistance and pre-existing models on data-mining, deep-learning, etc. It also has certain features that do not require coding, just select a dataset, a classifier and run them.
For platforms like Scikit-learn, R, deeplearning4j, etc., Weka provides proper access through its platform. For deep learning, we can use the wekadeeplearning4j library.
Just like Shogun, it is a highly research-oriented framework and used in many corporates as well.
Dask is another open-source ML framework based on python. Its closely integrated with other major community projects like Numpy, Pandas, and Scikit-Learn. Dask actually provides additional improvements and features to these three mentioned libraries. Like for Numpy, we can use dask arrays in place of NumPy arrays. Dask arrays help to cut larger arrays into smaller segments that can prove helpful for smaller memories. Dask arrays come helpful in fields like oceanography, large-scale imaging, etc.
A dask array will have multiple segments of the NumPy array in it. These NumPy arrays might remain in the disk or in multiple systems.
In pandas and Scikit-learn as well, dask comes handy. A dask dataframe has parallel smaller pandas dataframes in it. These pandas dataframes might exist on some disk or on multiple devices forming clusters. For Scikit-learn, it extends the parallel computing concept even further. Scikit-Learn provides parallel computing with joblib, but on a single machine (Joblib has some tools, which help in pipelining). Dask takes it further by providing parallel computing on multiple devices.
a. Spark ML Library
The Apache Spark ML Library is a service that consists of commonly used ML algorithms like clustering, classification, regression, etc. The organization aims to provide higher-level APIs for users for better and easier learning and practicing experiences. Apache Spark aims to provide scalable and more flexible ML services. Spark has it’s roots in JAVA. The framework has a very important library and it should be remembered as ‘spark.ml’. This is a JAVA based library and it helps in improving ML pipelining and provides high-level APIs.
b. Apache Mahout
The Apache Mahout is a mathematical framework (distributed linear algebra-based) of ML used by various data scientists, mathematicians, etc. The framework runs on Hadoop. Mahout mainly works on three techniques. These are classification, recommendation and clustering. Mahout provides various JAVA based libraries to provide scalable ML models for these techniques. It is kind of a work in progress framework, but developers prefer Apache spark more.
Mahout also has data mining capabilities. It provides a predesigned framework especially for mining of huge quantities of data. Large companies like Facebook, twitter etc., use this service to gather information on user interests.
List of Frameworks used in Deep Learning
Now, as we have covered the important and useful frameworks of machine learning, let’s try to explore the same in deep learning:
Tensorflow, probably one of the most used frameworks for deep learning worldwide, is an open-source and python friendly library. Google developed it, and it is very useful in developing and studying neural networks. Tensorflow has a very modern approach to tackling real-world problems.
It provides certain levels of abstraction. This helps you to have a look at the segments that you really need to see and that you don’t have to keep on searching for it. Tensorflow makes use of a high-level Keras API (Keras is another deep learning framework, but here we use it’s TensorFlow variant). The Keras API is very efficient and eases the making of ML models.
It also makes predictions a lot less hard. The best thing about TensorFlow is that it lets you train your model easily irrespective of the platform (Web, servers, devices, etc.) and the language. You can work efficiently without worrying about speed and computational power.
Pytorch is a modern-day framework and globally used in research and various deep learning projects. This was made by both Facebook’s AI team and Uber’s Pyro software. It is an open-source framework and strongly uses GPUs and CPUs. It is also an optimized version of Tensor, which is another framework and a user-friendly interface. The computational power consumption is shown in the form of computational graphs, which gives a proper insight to developers of how much processing power will the algorithm consumes.
One of the reasons why Pytorch has an advanced structure is because it has three levels of abstractions. These are:
Here Tensor provides an n-dimensional array to run in the GPU. The variable is a node in the computational graph. It stores the gradient of the graph and the data point. Finally, the Module is a neural network layer. This stores the state or also the learnable weight of the nodes in the neural network.
It also provides various loss functions. This is easy to implement and understand the code. It provides a lot of abstraction just like a tensor. It can also be termed as an extended version of Numpy to GPUs.
When you compare it with TensorFlow, it has some variations. Like TensorFlow does not show any computational graph. Tensorflow works better when it comes to embedded frameworks, while Pytorch works for both mobile and embedded.
Keras is a very popular framework used in machine learning. Being open-source, its also based on python. Keras runs on top of powerful deep learning libraries like TensorFlow, Theano, CNTK, etc. Despite the presence of such powerful libraries, Keras is the optimal choice when it comes to developing deep learning models. That has some reasons for it. Since Keras runs on a minimal structure, it tries to provide simpler ways to develop models based on top of TensorFlow. It provides lesser computational strain. Keras can run for both CPUs and GPUs. It supports being operative on multiple platforms. It is useful for both CNN and RNN.
Caffe is a framework built on C++ with small bindings with languages like python. A research team in Berkeley developed it. Caffe might be easier to learn, but due to its poor documentation, people lean more towards Tensorflow due to its programmatic approach. However, the new Caffe2 has been gaining popularity as companies like Facebook and Pinterest use it. Caffe is not good to use with RNNs. It is easier to learn than TensorFlow. But, since it is more technically advanced, TensorFlow will be the one people will incline for. As it is more robust and can be used for multiple deep learning scenarios.
H2O is a product of the company H2O.ai. The other popular products of H2O.ai include:
- H2O Sparkling Water
- Driverless AI
Sparkling water is a combination of H2O algorithms along with the Apache Spark framework. Sparkling water helps to manage large quantities of data used in ML algorithms. Spark framework is meant for handling large datasets.
Driverless AI is an AI-based platform that used for practicing automated ML. This is one of the top products of H2O.ai in the market. The amazing thing about this product is that it automates many complex tasks in data science and machine learning. It automates various complicated tasks such as model selection, model tuning, etc. It also provides results of the highest accuracy when it comes to predictions and in a much shorter time. The platform is also very flexible when it comes to working with various data management platforms like Amazon S3, Hadoop, etc. It can work with any cloud like AWS, Azure, etc. Also, it gives a lot of emphasis on GPUs. Some algorithms would require multiple GPUs for performance. These algorithms include K-means, XGBoost, etc. GPU creators like NVIDIA provide top quality GPUs.
Other than that, Driverless Ai helps in Time series forecasting, Natural Language Processing using Tensorflow and most importantly, it provides something known as custom recipe support. In this, you can add or import your own work and combine it with other built-in features.
H2O4GPU is an open-source machine learning package of GPU solvers. GPU solvers are the tools that make use of or exploit the high computation power of the GPUs. Different types of solvers are there for various GPUs. It is built upon Scikit to learn python API. There is also an R API under development. H2O4GPU nicely utilizes the parallelism and throughput of the GPUs.
These were the products of H2O.ai and the description of the H2O framework. Currently, the version is the H2O 3 series. H2O provides R and python packages for easy installation.
Theano is a python-based package used in machine learning due to its ability to process and evaluate mathematical expressions. But, it deals with expressions that include multidimensional arrays. Theano helps in process large amounts of data at a higher speed. It makes use of GPU to attain greater speed than the programs that run on the CPU. Also, we know that languages like C are one of the fastest languages when it comes to run time. In this case, Theano can overcome the speed of C language on a CPU, with the help of GPUs.
Theano has close relations with NumPy. For Theano compiled functions, use ‘numpy.ndarray’. We have some specific things to know about Theano like for situations where multiple expressions are simultaneously evaluated, Theano can minimize or reduce the amount of analysis but still focus on the key symbolic features of the expressions. This does not affect the evaluation speed, which is a critical aspect.
Theano still exists, but it’s developer MILA has stated that they would not be engaging in the further development of Theano. But, instead of Theano, Tensorflow is much more preferred. There are some reasons for it. Theano doesn’t show a computational graph, unlike TensorFlow. Theano has slower compilation time but a faster execution time than TensorFlow. We usually use Theano in mathematical operations, but TensorFlow is very diverse in that aspect. Tensorflow is used in text/image recognition, sound analysis, deep learning, etc. Tensorflow provides a much more flexible architecture. In Theano, we might get error messages that might be unclear.
Amazon Machine Learning
For fields like ML and deep learning development, Amazon is one of the top companies in the world at the moment. Amazon Machine Learning helps in developing predictive mathematical models and algorithms using the user’s data. More importantly, for the users who are not very used to machine learning, the platform provides various visualization tools, that help in creating ML models without the user having to learn the long and complex algorithms. One such amazing service is the Amazon Sagemaker. It removes various complexities form the ML workflow, which makes working on ML and data science models less straining. Amazon also provides numerous AI applications and every application has a different service. Let’s see an example, if we have a text- analytics task, we will deploy Amazon Comprehend. For Chatbots, there is Amazon Lex. For text to speech conversion, there is Amazon Polly. There are so many more applications.
Also, Amazon integrates machine learning with various other AWS services that it provides. Like, when it comes to using stored data, services like Amazon S3, Redshift, RDS come into use.
Google Cloud ML Engine
Google as we all know has been one of the biggest tech companies of the past two decades. They are at the forefront of all the latest technology research. Similarly, when it comes to AI and ML, google provides you great resources to work on. In this case, for Machine Learning, Google provides a service known as Google Cloud ML Engine. This service is very helpful for training and testing superior ML and deep learning models. Data scientists and ML developers mainly use this. The services provided by Google here have integration with the cloud. So, we have this huge network of cloud computing services and the ML tools are a part of these services that Google provides.
This is very important for businesses as Google’s tools and ML services provide developers a great platform to create and test their models. Various flexible tools like Tensorflow, Keras, Pytorch, Scikit-learn, etc., have libraries that the user can implement here. There are some crazy deep learning project models like removing noise from images (Image segregation project), advanced NLP, etc.
Google also provides some other ML services like Cloud Vision API. In this, we can take the example of a Google camera. It can search and translate any unknown text or image. This is one of Google’s most remarkable and revolutionary inventions of Google. Similarly, we have Cloud Translate API. We also have this on our phones as Google Translate. It is a very efficient language translation interface.
Google keeps on advancing and researching on it every year to make it a better service. It provides a voice to text translations, which is helpful if you are in a country where you don’t speak the local language. We then have some data warehousing services like BigQueryML that allows users to execute ML models through some specific SQL queries. The best part is that it is trained where the data is stored. So, there is no wastage of time in transferring data.
Lastly, we have a service that is still in the beta testing phase. Cloud AutoML would encourage users with little or no knowledge of ML and data science to try and run pre-built API models for better understanding. This would be beneficial for businesses too as they would only feed their respective data into pre-existing APIs.
Azure ML studio
Just like all other big companies, Microsoft stands as one of the best when it comes to research and technology. As one of the pioneers in modern-day machine learning, it has some amazing services of its own. Azure ML studio is one such ML-based service. The developers have the freedom to create and run the models and also, they can convert it into an API for others to use. Just like Google Cloud, Azure has a cloud service of its own and it integrates it with the studio for complex models.
Its also known as the drag and drop tool because the developers can just create and deploy their models directly. The studio has some differences when compared with Azure ML. Azure ML is for the enterprise workspace. Whereas for the studio, you can it for free for nearly 6-8 hours (anonymously) without creating an account. In Azure ML you can get as much storage as your project requires as it is sponsored by an enterprise. For Studio, it is nearly a 10GB limit. Pipelining is available in Azure ML to provide better workflow and that is absent in ML studio.
ONNX or the Open Neural Network Exchange provides an efficient way to run ML models with the help of CPUs and GPUs. It is a great platform to transfer your work from one framework to another without any conversion to your work. For example, if two big companies like tesla and google decide to work on projects together, then their data scientists and developers would be easily able to exchange the model from different frameworks using ONNX. The conversion process requires some specific libraries that ONNX provides. The steps of using ONNX are:
- Create your model in any framework.
- Convert the model into ONNX format.
- Load and run your model.
MXNET is an ML service provided by Apache. It provides python APIs to help a large group of ML developers. One is Gluon API and the other is Module API. The Gluon API helps in prototyping and easier training and deployment of the model. Whereas, Module API provides predefined networks via packages and makes the job less stressful as creating a neural network requires a lot of work and time. Both APIs perform the tasks without sacrificing the speed of the processing. The language used in both these APIs is python.
Apple Core ML
Core ML is one of the ML services that Apple provides. This framework helps to insert ML models into apps. Every apple device that contains apps will definitely have Core ML in them. An example would simplify everything. Your face unlocks, the image scanning, the text translation everything that an iPhone can do, Core ML is the reason behind it. For all these above features, Core ML has a pre-trained model and its inserted into the apps. These include Vision for face and image scanning, NLP for text and speech recognition, for implementing game logic, etc. These frameworks collectively form the ML infrastructure for any Apple device.
Microsoft Cognitive Toolkit (CNTK)
Lastly, CNTK is an open-source deep learning framework. Its mainly used for creating algorithms for time-series predictions feed-forward neural networks etc. The framework has several built-in components that enable it to handle multidimensional data. Its functions are mostly written in C++ for greater performances, but generally, python language is more preferred. Another built-in function is that we can implement all three CNN, RNN, and FNN. This has a functionality that allows users to add certain user-defined components to the GPU. It has in-built hyperparameter tuning. It also provides different libraries for different languages like python, C++, C#. CNTK supports ONNX and is one of the only frameworks to do so.
In this article, we finally looked at various frameworks, both from ML and deep learning background. At times, we did minor comparisons of frameworks while explaining about them. We also looked at some basic syntaxes for importing certain libraries and we understood how robust they are.
This would be a very helpful article if you want to try some of these frameworks and libraries for yourself. But, to understand the working of these frameworks, using them in codes and projects is highly recommended. Understanding a framework demands practice.
Do not forget to share your TechVidvan Experience with us.