Jul 17, 2019 By Team YoungWonks *
The top machine learning libraries today are - not surprisingly - in great demand across the world. These machine learning libraries or frameworks have helped developers do away with the task of manually coding all the algorithms and mathematical and statistical formula. To begin with, let’s look at what is a machine learning library? And which are the leading names in this area? With Machine Learning (ML) and Artificial Intelligence (AI) driving the latest phase of the tech revolution, it is indeed increasingly important now to be aware of key concepts in both these areas.
What is a Machine Learning Library?
A machine learning library, also called a machine learning framework, refers to sets of routines and functions that are written in a given programming language. These are interfaces, libraries or tools that help developers to easily and quickly create machine learning models, without getting into the specific basic details of the underlying algorithms. So a robust collection of such libraries will make it easier for developers to carry out complex tasks without having to rewrite many lines of code. In other words, they offer a clear, concise way to define machine learning models using a set of pre-built, optimized components. Their goal is to simplify machine learning and make it easier for use by developers.
A good ML library / framework is typically optimized for performance; quite developer friendly with the framework using traditional ways of building models and is rather easy to understand and code on.
Another key concept in machine learning that we need to look at is that of neural networks. What is a neural network? Artificial neural networks (ANN) or connectionist systems are essentially computing systems that are inspired by, but not necessarily identical to, the biological neural networks that make up animal brains. Such systems “learn” to carry out tasks by going through examples, and usually without being programmed with any task-specific instructions. For example, for image recognition, a neural network can learn to identify images containing cats by analyzing example images that have been manually labeled as “cat” or “no cat” and then using the results to identify cats in other images. In other words, they automatically come up with identifying characteristics from the learning material that they process.
And while there are several machine learning frameworks/ libraries out there, in this blog, we shall be looking at some of the leading names in the field:
TensorFlow is a free and open-source software library that is used for research and production in the field of machine learning. Created by the Google Brain team, it has paved the way for a revolution of sorts thanks to the fact that it allows easy and effective implementation of machine learning algorithms. It is an efficient math library and is also used for machine learning applications such as neural networks. Moreover, TensorFlow offers distribution functions such as Bernoulli, Beta, Chi2, Uniform, Gamma, which are important while considering probabilistic approaches such as Bayesian models. With the advent of high level APIs (Application Programming Interfaces) like Keras and Theano, it has made massive strides in enhancing the capability of computers so as to predict solutions with a greater degree of accuracy. The advantage of parallel processing makes TensorFlow the need of the hour. The speed at which TensorFlow processes data is almost unparalleled, especially when you consider its accuracy. It is important to note that TensorFlow offers stable APIs for Python and C. It is easily trainable on CPU as well as GPU (Graphics Processing Unit) for distributed computing. It is also fairly flexible in its operations. Using it, one can train multiple neural networks and multiple GPUs thus making the models very efficient on large-scale systems. Other advantages include a large community which is not surprising given its Google roots and the fact that a large team of software engineers continue to work on stability improvements. One can thus use this library/ framework to come up with an amazing variety of useful products; it even has feature columns that can be looked at as intermediaries between raw data and estimators, thus bridging the input data with one’s model. Other key features include layered components and event logger and visualizer (with TensorBoard, a set of visualization tools). There are a host of advantages on offer here: think better computational graph visualizations; good library management offering seamless performance, quick updates and frequent new releases with new features; good debugging methods, scalability and compatibility with various backends software like GPU, ASIC, etc. However, TensorFlow also has some disadvantages. For instance, it doesn’t have symbolic loops that are most needed for working with variable length sequences. Even on the computation speed and usage front, TensorFlow can do better. Plus, it offers no GPU support other than Nvidia and only language supported is Python. Overall, TensorFlow TensorFlow still has a lot of features it can provide and there is a strong and growing Internet community out there to help one with it. Look at our blogs (https://www.youngwonks.com/blog/How-to-install-Tensorflow-on-a-Mac and https://www.youngwonks.com/blog/How-to-install-Tensorflow-on-Windows) to see how one can download TensorFlow on Mac and Windows respectively. Bear in mind that certain versions of TensorFlow might not work on certain operating systems and the user needs to check if the version of tensorflow being downloaded/ installed is compatible with the computer’s operating system.
Keras is an open-source neural-network library written in Python and it supports multiple back-end neural network computation engines. It is capable of running on top of frameworks such as TensorFlow, Microsoft Cognitive Toolkit, Theano. So it can be described as a minimalist Python library for deep learning that can run on top of TensorFlow or Theano. Built to enable fast experimentation with deep neural networks, it focuses on being user-friendly, modular, and extensible. This library includes many implementations of commonly used neural-network building blocks like layers, objectives, activation functions, optimizers, and a whole set of tools aimed at making working with image and text data much easier. Along with standard neural networks, Keras supports convolutional and recurrent neural networks. It supports other common utility layers like dropout, batch normalization, and pooling. Developed and maintained by developed and maintained by Google engineer François Chollet, some of the key features of Keras include modularity, where a model can be understood as a sequence or a graph alone; minimalism so that the library offers just enough to get an outcome, without any frills and maximizing readability and extensibility wherein new components are easy to add and use within the framework, thus helping researchers to do more trials. It is also important to note that everything in Keras is native Python.
Keras is quite user friendly and in addition to ease of learning and ease of model building, it boasts the advantages of broad adoption, support for a wide range of production deployment options, integration with back-end engines / frameworks as mentioned earlier, and strong support for multiple GPUs and distributed training. Keras can thus be used for machine learning libraries as an artificial intelligence testing tool, which allows fast prototyping and supports recurring and convolutional networks. Plus, Keras is backed by big names in the tech industry such as Google, Microsoft, Amazon, Apple, Nvidia, Uber and others, adding to its credibility. Among its disadvantages, it is said that developers end up having to delve into Keras source code and tinker with it too for almost anything save for the simplest use-cases. Another point is that Keras data-processing tools have been found to be not as useful, with users needing to write their own sequence/non-sequence pre-processing routines or using a good external package like Scikit-learn. Going beyond surface-level customization is also said to be not all that easy.
Scikit-learn is a free machine learning library for Python built on SciPy. It is quite an effective tool for data mining and data analysis and can be used for both personal and commercial reasons. It incorporates several classification, regression and clustering algorithms including support vector machines, random forests, gradient boosting, k-means and DBSCAN, and is created so as to interoperate with the Python numerical and scientific libraries NumPy and SciPy. With Scikit-learn, different tasks can be conducted - think model selection, clustering, preprocessing, and more. The library supports different types of traditional machine learning methods and operations in addition to giving developers the means to complete implementations. Today, it is being used by big companies from different industries such as music streaming, hotel bookings, etc. Advantages of Scikit-learn are that it has a clean API, is fast, easy to use, comprehensive and robust in that it is well documented and supported, released under a permissive license and has a very active developer community. Thanks to its simplicity and accessibility, it is often the first choice in Machine Learning when one is working on a Python project, especially one that doesn’t require massively scalable algorithms. It has some limitations too: for one, it has less focus on statistics. It is also not ideal for deep learning; leaving it as a good bet for only simple data tasks carried out by beginners.
4. Microsoft Cognitive Toolkit
Released in the year 2016, Microsoft Cognitive Toolkit is an AI framework solution, that has been developed by Microsoft Research and equips machine learning projects with new capabilities. This is a machine learning library that has both a low-level and high-level API for building neural networks. An open-source framework, it describes neural networks as a set of computational steps through a directed graph, and can train deep learning algorithms for functions similar to the human brain. While the low-level API is to be used by scientists looking to build the next generation of neural network components, the high-level API can be used for creating production-quality neural networks. Microsoft Cognitive Toolkit’s features also include components that monitor and debug neural networks, in addition to highly optimized and enriched components focusing on the introduction of artificial intelligence technology. These components can work with data from C++, Python or BrainScript, can be easily integrated with Microsoft Azure, and boast interoperation with NumPy. In fact, developers can train their models in Python and use them from C# and Java.
Theano is a Python ML library where computations are expressed using a syntax similar to that of another Python library NumPy and compiled to run efficiently on CPU or GPU architectures. An open source project developed by Montreal Institute for Learning Algorithms (MILA) at the Université de Montréal, it lets one define, optimize, and efficiently evaluate mathematical expressions that include multi-dimensional arrays. So Theano offers features such as tight integration with NumPy, transparent use of a GPU (where one can perform data-intensive computations much faster than on a CPU), efficient symbolic differentiation and extensive unit-testing and self-verification where one can catch and address several kinds of errors. Theano basically combines aspects of a computer algebra system (CAS) with aspects of an optimizing compiler. It can also be used to generate customized C code for mathematical operations.
A deep learning framework originally developed at the University of California, Berkeley, CAFFE - short for Convolutional Architecture for Fast Feature Embedding - is written in C++, with a Python interface. This open-source library supports fully connected neural network designs and several different types of deep learning architectures including those dealing with image classification and image segmentation. Additionally, it supports GPU- and CPU-based acceleration computational kernel libraries like Intel Math Kernel Library and NVIDIA cuDNN. Also important is the fact that Caffe is very useful in areas like research and industry where speed is crucial for state-of-the-art models and huge amounts of data. It also offers modularity, which comes in handy given that often new tasks and settings need flexibility and extension. No wonder then, Caffe’s areas of use include academic research projects, prototypes for emerging companies and even large-scale industrial applications in vision, speech and multimedia. In fact, Yahoo! has also integrated Caffe with Apache Spark to create the distributed deep learning framework, CaffeOnSpark.
7. Amazon Machine Learning
Amazon Machine Learning by Amazon Web Services (AWS) is a service that makes it easy for developers with different skill levels to use machine learning (ML) technology. Compatible with major AI frameworks, it is known for offering ready-to-use artificial intelligence solutions. High performance computing with utmost security is what the brand promises; moreover, it offers visualization tools that help developers with the process of building ML models without having to learn complex ML algorithms and technology. Connecting to data saved in Amazon’s various storage models such as Amazon S3, Redshift or RDS, Amazon Machine Learning can run binary classification, multiclass categorization, or regression on the data to build a model. Developers get to pick from pre-trained AI services for computer vision, language, recommendations, and forecasting, and they can use Amazon SageMaker, the in-house cloud machine-learning platform to quickly build, train and deploy machine learning models at scale.
A machine learning library for Python programming language that is based on the Torch library (which is no longer in active development), PyTorch has been primarily developed by Facebook’s AI Research lab (FAIR); it is used for applications like computer vision and natural language processing. While this free and open-source software boasts a rather polished Python interface, it also has a C++ interface. Two high-level features are on offer here. Firstly, there’s Tensor computing (like NumPy) with strong acceleration via graphics processing units (GPU) and additionally, there are the deep neural networks that have been created on a tape-based autodiff system. Indeed, many deep learning softwares have been/ are being built on top of PyTorch; instances include Uber’s Pyro HuggingFace’s Transformers and Catalyst.
9. Google Cloud ML Engine
Developers can use the Google Cloud ML engine for the stages of training and development of ML models. With Cloud ML engine, they can train their ML models in the cloud using Google’s distributed network of computers. Instead of just using their laptops to train the models, Google shall run the developer’s training algorithm on multiple computers to speed up the process. This means that by working with Google Cloud ML Engine, one doesn’t have to worry about storing the training data. Even if one needs a million emails to train a spam filter, the model can easily be trained using Google Cloud ML Engine, as this vast training data can be stored online in a Google Cloud Storage “Bucket”.
10. Azure ML Studio
This ML framework allows Microsoft Azure users to create and train models, then turn them into APIs (Application Program Interfaces) that can be used by other services. There is also the option of connecting one’s own Azure storage to the service for larger models. The service actually runs on Azure public cloud, which means that users do not have to purchase any hardware or software; similarly, deployment and maintenance are not a worry either. Essentially an integrated development environment, Azure ML Studio helps people without data science background create data models through drag-and-drop gestures and simple data flow diagrams. This minimizes coding and saves a lot of time thanks to ML Studio’s library of sample experiments. At the same time, data scientists have something to cheer about as well: for Azure ML Studio also supports R. This means they can just drop existing R code directly into Azure ML, or develop their own code with the more than 350 R packages supported by ML Studio. Lastly, it’s interesting to note that in order to use the Azure ML Studio, one doesn’t even need an account to try out the service; one can log in anonymously and use Azure ML Studio for as long as eight hours.
*Contributors: Written by Vidya Prabhu; Lead image by: Leonel Cruz