© Michael Paluszek, Stephanie Thomas  2017

Michael Paluszek and Stephanie Thomas, MATLAB Machine Learning, 10.1007/978-1-4842-2250-8_3

3. Software for Machine Learning

Michael Paluszek and Stephanie Thomas1

(1)New Jersey, USA

3.1 Autonomous Learning Software

There are many sources for machine learning software. Machine learning encompasses machine learning software to help the user learn from data and software that helps machines learn and adapt to their environment. This book gives you a sampling of software that you can use immediately. However, the software is not designed for industrial applications. This chapter describes software that is available for the MATLAB environment. Both professional and open-source MATLAB software is discussed. The book may not cover every available package, as new packages are continually becoming available while older packages may become obsolete.

This chapter includes software for what is conventionally called “machine learning.” These are the statistics functions that help give us insight into data. These are often used in the context of “big data.” It also includes descriptions of packages for other branches of autonomous learning systems such as system identification. System identification is a branch of automatic control that learns about the systems under control, allowing for better and more precise control.

The chapter, for completeness, also covers popular software that is MATLAB compatible but requires extra steps to use it from within MATLAB. Examples include R, Python, and SNOPT. In all cases it is straightforward to write MATLAB interfaces to these packages. Using MATLAB as a front end can be very helpful and allow you to create integrated packages that include MATLAB, Simulink, and the machine learning package of your choice.

You will note that we include optimization software. Optimization is a tool used as part of machine learning to find the best or “optimal” parameters. We use it in this book in our decision tree chapter.

Don’t be upset if we didn’t include your favorite package, or your package! We apologize in advance!

3.2 Commercial MATLAB Software

3.2.1 MathWorks Products

The MathWorks sells several packages for machine learning. These are in the Machine Learning branch of our taxonomy Figure 1.3. The MathWorks products provide high-quality algorithms for data analysis along with graphics tools to visualize the data. Visualization tools are a critical part of any machine learning system. They can be used for data acquisition, for example, for image recognition or as part of systems for autonomous control of vehicles, or for diagnosis and debugging during development. All of these packages can be integrated with each other and with other MATLAB functions to produce powerful systems for machine learning. The most applicable toolboxes that we will discuss are

  • Statistics and Machine Learning Toolbox

  • Neural Network Toolbox

  • Computer Vision System Toolbox

  • System Identification Toolbox

3.2.1.1 Statistics and Machine Learning Toolbox

The Statistics and Machine Learning Toolbox provides data analytics methods for gathering trends and patterns from massive amounts of data. These methods do not require a model for analyzing the data. The toolbox functions can be broadly divided into classification tools, regression tools, and clustering tools.

Classification methods are used to place data into different categories. For example, data, in the form of an image, might be used to classify an image of an organ as having a tumor. Classification is used for handwriting recognition, credit scoring, and face identification. Classification methods include support vector machines (SVMs), decision trees, and neural networks.

Regression methods let you build models from current data to predict future data. The models can then be updated as new data become available. If the data are only used once to create the model, then it is a batch method. A regression method that incorporates data as they become available is a recursive method.

Clustering finds natural groupings in data. Object recognition is an application of clustering methods. For example, if you want to find a car in an image, you look for data that are associated with the part of an image that is a car. While cars are of different shapes and sizes, they have many features in common.

The toolbox has many functions to support these areas and many that do not fit neatly into these categories. The Statistics and Machine Learning Toolbox is an excellent place to start for professional tools that are seamlessly integrated into the MATLAB environment.

3.2.1.2 Neural Network Toolbox

The MATLAB Neural Network Toolbox is a comprehensive neural net toolbox that seamlessly integrates with MATLAB. The toolbox provides functions to create, train, and simulate neural networks. The toolbox includes convolutional neural networks and deep learning networks. Neural networks can be computationally intensive because of the large numbers of nodes and associated weights, especially during training. The Neural Network Toolbox allows you to distribute computation across multicore processors and graphical processing units (GPUs) if you have the Parallel Computing Toolbox, another MATLAB add-on. You can extend this even further to a network cluster of computers using MATLAB Distributed Computing Server™. As with all MATLAB products, the Neural Network Toolbox provides extensive graphics and visualization capabilities that make it easier to understand your results.

The Neural Network Toolbox is capable of handling large data sets. This could be gigabytes or terabytes of data. This makes it suitable for industrial-strength problems and complex research. MATLAB also provides videos, webinars, and tutorials, including a full suite of resources for applying deep learning.

3.2.1.3 Computer Vision System Toolbox

The MATLAB Computer Vision System Toolbox provides functions for developing computer vision systems. The toolbox provides extensive support for video processing but also includes functions for feature detection and extraction. It also supports three-dimensional (3D) vision and can process information from stereo cameras. 3D motion detection is supported.

3.2.1.4 System Identification Toolbox

The System Identification Toolbox provides MATLAB functions and Simulink blocks for constructing mathematical models of systems. You can identify transfer functions from input/output data and perform parameter identification for models. Both linear and nonlinear system identification is supported.

3.2.2 Princeton Satellite Systems Products

Several of our own commercial packages provide tools within the purview of autonomous learning.

3.2.2.1 Core Control Toolbox

The Core Control Toolbox provides the control and estimation functions of our Spacecraft Control Toolbox with general industrial dynamics examples including robotics and chemical processing. The suite of Kalman filter routines includes conventional filters, extended Kalman filters, and unscented Kalman filters (UKFs). The unscented filters have a fast sigma-point calculation algorithm. All of the filters can now handle multiple measurement sources that can be changed dynamically. Add-ons for the Core Control Toolbox include imaging and target tracking modules. Imaging includes lens models, image processing, ray tracing, and image analysis tools.

3.2.2.2 Target Tracking

The target tracking module employs track-oriented multiple-hypothesis testing (MHT). Track-oriented MHT is a powerful technique for assigning measurements to tracks of objects when the number of objects is unknown or changing. It is absolutely essential for accurate tracking of multiple objects.

In many situations a sensor system must track multiple targets, like in rush-hour traffic. This leads to the problem of associating measurements with objects, or tracks. This is a crucial element of any practical tracking system.

The track-oriented approach recomputes the hypotheses using the newly updated tracks after each scan of data is received. Rather than maintaining, and expanding, hypotheses from scan to scan, the track-oriented approach discards the hypotheses formed on scan k − 1. The tracks that survive pruning are propagated to the next scan k, where new tracks are formed, using the new observations, and reformed into hypotheses. The hypothesis formation step is formulated as a mixed-integer linear program and solved using GNU Linear Programming Kit (GLPK). Except for the necessity to delete some tracks based upon low probability, no information is lost because the track scores, which are maintained, contain all the relevant statistical data.

The MHT module uses a powerful track-pruning algorithm that does the pruning in one step. Because of its speed, ad hoc pruning methods are not required, leading to more robust and reliable results. The track management software is, as a consequence, quite simple.

The toolbox includes Kalman filters, extended Kalman filters, and UKFs. All of the Kalman filters use a common code format with separate prediction and update functions. This allows the two steps to be used independently. Each Kalman filter can handle multiple measurement sources and measurements arriving at different times. All three Kalman filters can be used independently or as part of the MHT system. The UKF automatically uses sigma points and does not require derivatives to be taken of the measurement functions or linearized versions of the measurement models.

Interactive multiple-model (IMM) systems can also be used as part of the MHT system. IMM employs multiple dynamic models to facilitate tracking maneuvering objects. One model might involve maneuvering while another models constant motion. Measurements are assigned to all of the models. The IMM systems are based on jump Markovian systems.

3.3 MATLAB Open-Source Resources

MATLAB open-source tools are a great resource for implementing state-of-the-art machine learning. Machine learning and convex optimization packages are available.

3.3.1 Deep Learn Toolbox

The Deep Learn Toolbox by Rasmus Berg Palm is a MATLAB toolbox for deep learning. It includes deep belief nets, stacked autoencoders, convolutional neural nets, and other neural net functions. It is available through the MathWorks File Exchange.

3.3.2 Deep Neural Network

The Deep Neural Network by Masayuki Tanaka provides deep learning tools of deep belief networks of stacked restricted Boltzmann machines. It has functionality for both unsupervised and supervised learning. It is available through the MathWorks File Exchange.

3.3.3 MatConvNet

MatConvNet implements convolutional neural networks for image processing. It includes a range of pretrained networks for image processing functions.

3.4 Products for Machine Learning

There are many products, both open-source and commercial, for machine learning. We cover some of the more popular open-source products. Both machine learning and convex optimization packages are discussed.

3.4.1 R

R is open-source software for statistical computing. It compiles on MacOS, UNIX, and Windows. It is similar to the Bell Labs S language developed by John Chambers and colleagues. It includes many statistical functions and graphics techniques.

You can use R in batch mode from MATLAB using the system command. Write

system(’R␣CMD␣BATCH␣inputfile␣outputfile’);

This runs the code in inputfile and puts it into outputfile. You can then read the outputfile into MATLAB.

3.4.2 scikit-learn

scikit-learn is a machine learning library for use in Python. It includes a wide variety of tools, including

  1. Classification

  2. Regression

  3. Clustering

  4. Dimensionality reduction

  5. Model selection

  6. Preprocessing

scikit-learn is well suited to a wide variety of data mining and data analysis.

MATLAB supports the reference implementation of Python, CPython. Mac and Linux users already have Python installed. Windows users need to install a distribution.

3.4.3 LIBSVM

LIBSVM [3] is a library for SVMs. It has an extensive collection of tools for SVMs including extensions by many users of LIBSVM. LIBSVM tools include distributed processing and multicore extensions.

3.5 Products for Optimization

Optimization tools often are used as part of machine learning systems. Optimizers minimize a cost given a set of constraints on the variables that are optimized. The maximum or minimum value for a variable is one type of constraint. Constraints and costs may be linear or nonlinear.

3.5.1 LOQO

LOQO [6] is a system for solving smooth constrained optimization problems available from Princeton University. The problems can be linear or nonlinear, convex or nonconvex, constrained or unconstrained. The only real restriction is that the functions defining the problem be smooth (at the points evaluated by the algorithm). If the problem is convex, LOQO finds a globally optimal solution. Otherwise, it finds a locally optimal solution near a given starting point.

Once you compile the mex-file interface to LOQO, you must pass it an initial guess and sparse matrices for the problem definition variables. You may also pass in a function handle to provide animation of the algorithm at each iteration of the solution.

3.5.2 SNOPT

SNOPT [4] is a software package for solving large-scale optimization problems (linear and nonlinear programs) hosted at the University of California, San Diego. It is especially effective for nonlinear problems whose functions and gradients are expensive to evaluate. The functions should be smooth but need not be convex. SNOPT is designed to take advantage of the sparsity of the Jacobian matrix, effectively reducing the size of the problem being solved. For optimal control problems, the Jacobian is very sparse because you have a matrix with rows and columns that span a large number of time points, but only adjacent time points can have nonzero entries.

SNOPT makes use of nonlinear function and gradient values. The solution obtained will be a local optimum (which may or may not be a global optimum). If some of the gradients are unknown, they will be estimated by finite differences. Infeasible problems are treated methodically via elastic bounds. SNOPT allows the nonlinear constraints to be violated and minimizes the sum of such violations. Efficiency is improved in large problems if only some of the variables are nonlinear, or if the number of active constraints is nearly equal to the number of variables.

3.5.3 GLPK

GLPK solves a variety of linear programming problems. It is part of the GNU project (https://www.gnu. org/software/glpk/). The most well-known one solves the linear program $$displaystyleegin{array}{rcl} Ax = b& &{}end{array}$$ (3.1)
$$displaystyleegin{array}{rcl} y = cx& &{}end{array}$$ (3.2)
where it is desired to find x that when multiplied by A equals b. c is the cost vector that when multiplied by x gives the scalar cost of applying x. If x is the same length as b, the solution is
$$displaystyle{ x = A^{-1}b }$$ (3.3)
Otherwise, we can use GLPK to solve for x that minimizes y. GLPK can solve this problem and others where x has to be an integer or even just 0 or 1.

3.5.4 CVX

CVX [2] is a MATLAB-based modeling system for convex optimization. CVX turns MATLAB into a modeling language, allowing constraints and objectives to be specified using standard MATLAB expression syntax.

In its default mode, CVX supports a particular approach to convex optimization that we call disciplined convex programming. Under this approach, convex functions and sets are built up from a small set of rules from convex analysis, starting from a base library of convex functions and sets. Constraints and objectives that are expressed using these rules are automatically transformed to a canonical form and solved. CVX can be used for free with solvers like SeDuMi or with a license from CVX Research with commercial solvers.

3.5.5 SeDuMi

SeDuMi [5] is MATLAB software for optimization over second-order cones, currently hosted at Lehigh University. It can handle quadratic constraints. SeDuMi was used in Acikmese [1]. SeDuMi stands for Self-Dual Minimization. It implements the self-dual embedding technique over self-dual homogeneous cones. This makes it possible to solve certain optimization problems in one phase. SeDuMi is available as part of YALMIP and as a standalone package.

3.5.6 YALMIP

YALMIP is free MATLAB software by Johan Lofberg that provides an easy-to-use interface to other solvers. It interprets constraints and can select the solver based on the constraints. SeDuMi and MATLAB’s fmincon from the Optimization Toolbox are available solvers.

References

[1] Behcet Acikmese and Scott R. Ploen. Convex programming approach to powered descent guidance for Mars landing. Journal of Guidance, Control, and Dynamics, 30(5):1353–1366, 2007.CrossRef

[2] S. Boyd. CVX: MATLAB software for disciplined convex programming. http://cvxr.com/cvx/ , 2015.

[3] Chih-Chung Chang and Chih-Jen Lin. LIBSVM – A library for support vector machines. https://www.csie.ntu.edu.tw/~cjlin/libsvm/ , 2015.

[4] Philip Gill, Walter Murray, and Michael Saunders. SNOPT 6.0 description. http://www.sbsi-sol-optimize.com/asp/sol_products_snopt_desc.htm , 2013.

[5] Jos F. Sturm. Using SeDuMi 1.02, a MATLAB toolbox for optimization over symmetric cones. http://sedumi.ie.lehigh.edu/wp-content/sedumi-downloads/usrguide.ps , 1998.

[6] R. J. Vanderbvei. LOQO user’s manual version 4.05. http://www.princeton.edu/~rvdb/tex/loqo/loqo405.pdf , September 2013.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.12.50