The article reads linear algebra of machine learning (10 cases)

Linear algebra is a branch of mathematics that involves vectors, matrices, and linear transformations.

It is an important foundation for machine learning. From the description of the operation of the algorithm to the implementation of the algorithm in the code, it belongs to the scope of the study of the discipline.

Although linear algebra is an integral part of machine learning, the close relationship between the two is often unexplained or can only be explained by abstract concepts such as vector space or specific matrix operations.

After reading this article, you will learn:

How to use linear algebraic structures when working with data, such as tabular datasets and images.

The concept of linear algebra used in data preparation, such as one-hot coding and dimensionality reduction.

Deep use of linear algebraic symbols and methods in sub-domains such as deep learning, natural language processing, and recommendation systems.

The article reads linear algebra of machine learning (10 cases)

let's start.

The 10 machine learning cases are:

Dataset and Data Files data sets and data files

Images and Photographs Images and Photos

One-Hot Encoding one-hot encoding

Linear Regression Linear Regression

RegularizaTIon Regularization

Principal Component Analysis Principal Component Analysis

Singular-Value DecomposiTIon Singular Value Decomposition

Latent SemanTIc Analysis Latent Semantic Analysis

Recommender Systems Recommended System

Deep Learning Deep Learning

1. Data sets and data files

In machine learning, you can fit a model on a data set.

This is a set of numbers in tabular format where each row represents a set of observations and each column represents a characteristic of the observation.

For example, the following set of data is part of the Iris data set

5.1,3.5,1.4,0.2,Iris-setosa

4.9,3.0,1.4,0.2,Iris-setosa

4.7,3.2,1.3,0.2,Iris-setosa

4.6,3.1,1.5,0.2,Iris-setosa

5.0, 3.6, 1.4, 0.2, Iris-setosa

The data is actually a matrix: a key data structure in linear algebra.

Next, the data is decomposed into input data and output data to fit a supervised machine learning model (such as measured values ​​and flower varieties) to obtain matrix (X) and vector (y). Vectors are another key data structure in linear algebra.

Each line has the same length, that is, the same number of data per line, so we can say that the data is vectorized. These row data can be provided to the model once or in batches, and the model can be pre-configured to obtain fixed-width row data.

2. Images and photos

Perhaps you are more accustomed to working with images or photos in computer vision applications.

Each image you use is a table structure with a fixed width and height. Each cell has 1 pixel value for representing a black and white image or 3 pixel values ​​for a color image.

The photo is also a kind of linear algebraic matrix.

Image-related operations, such as cropping, scaling, and clipping, are described using linear algebraic symbols and operations.

3. one-hot coding

Sometimes classification data is used in machine learning.

It may be a category label to solve a classification problem, or it may be a classification input variable.

It is common to code categorical variables so that they are easier to use and learn through certain techniques. One-hot encoding is a common categorical variable encoding.

One-hot encoding can be understood as: creating a table, showing each category with a column, and representing each instance of the dataset with a row. Add a check or "1" value in the column for the categorical value of a given row, and add the "0" value to all other columns.

For example, a total of 3 lines of color variables:

Red

Green

Blue

. . .

These variables may be coded as:

Red, green, blue 1, 0, 0 0, 1, 0 0, 0, 1. . .

Each line is encoded as a binary vector, a vector that is assigned a "0" or "1" value. This is an example of sparse characterization, a complete subdomain of linear algebra.

4. Linear regression

Linear regression is a statistically traditional method used to describe the relationship between variables.

This method is commonly used in machine learning to predict numerical values ​​for simpler regression problems.

There are many ways to describe and solve the linear regression problem, namely to find a set of coefficients, use these coefficients to multiply each input variable and add the results to get the best output variable prediction.

If you have used machine learning tools or machine learning libraries, the most common way to solve linear regression problems is through least-squares optimization, which is solved using a linear regression matrix decomposition method (such as LU decomposition or singular value decomposition).

Even the commonly used method of linear regression equations uses linear algebraic notation:

y = A. b

Where y is the output variable, A is the data set, and b is the model coefficient.

5. Regularization

When applying machine learning, we often seek the simplest and most feasible model to play the best skills in problem solving.

Simpler models are generally better at generalizing from specific examples to unseen data.

In many methods involving coefficients, such as regression methods and artificial neural networks, simpler models usually have smaller coefficient values.

A technique that is commonly used to minimize coefficient values ​​when the model fits in the data is called regularization. Common implementations include the regularized L2 and L1 forms.

These two regularized forms are actually measures of the size or length of a coefficient vector, and are directly derived from a linear algebra method called a vector norm.

6. Principal component analysis

In general, there are many columns of datasets, and the number of columns may reach tens, hundreds, thousands, or more.

Modeling data with many characteristics is challenging. Moreover, models built from data containing irrelevant features are generally not as good as models trained with the most relevant data.

It is difficult to know which features of the data are relevant and which features are not relevant.

The method of automatically reducing the number of dataset columns is called dimensionality reduction, and perhaps the most popular method is Principal Component Analysis (PCA).

This method creates projections of high-dimensional data for visualization and models in machine learning.

The core of the PCA method is the matrix decomposition method of linear algebra, which may use eigen decomposition, and the more general implementation may use singular value decomposition (SVD).

7. Singular Value Decomposition

Another popular dimension reduction method is the singular value decomposition method, abbreviated as SVD.

As mentioned above, as the name of the method shows, it is a matrix decomposition method derived from the field of linear algebra.

This method has a wide range of applications in linear algebra and can be directly applied to feature selection, visualization, and noise reduction.

In machine learning we see the following two cases of using SVD.

8. Latent semantic analysis

In the machine learning subfield for processing text data (referred to as natural language processing), documents are usually represented as a large matrix of word appearances.

For example, a column of a matrix may be a known word in a vocabulary, a row may be a sentence, a paragraph, a page, or a document in text, and a cell in the matrix is ​​labeled with the number or frequency of occurrences of the word.

This is a sparse matrix representation of the text. Matrix decomposition methods (such as singular value decomposition) can be applied to this sparse matrix. This decomposition method can extract the most relevant part of the matrix representation. Documents processed in this way are easier to compare, query, and serve as a basis for monitoring machine learning models.

This form of data preparation is called Latent Semantic Analysis (LSA for short), also known as Latent Semantic Indexing (LSI).

9. Recommended system

The problem of predictive modeling that involves product recommendation is called the recommendation system, which is a subfield of machine learning.

For example, recommend a book based on your purchase history on Amazon and a purchase record similar to yours, or recommend a movie or TV show based on your or your similar user's viewing history on Netflix.

The development of the recommended system mainly involves the linear algebra method. A simple example is to use distance metrics such as Euclidean distance or dot product to calculate the similarity between sparse customer behavior vectors.

Matrix decomposition methods such as singular value decomposition are widely used in recommendation systems to extract useful parts of project and user data for query, retrieval, and comparison.

10. Deep learning

Artificial neural network is a kind of non-linear machine learning algorithm, which is inspired by the information processing elements in the brain. Its effectiveness has been verified in a series of problems, the most important of which is prediction modeling.

Deep learning is a recent renaissance of artificial neural networks using the latest methods and faster hardware. This approach makes it possible to develop and train larger and deeper (more layers) networks on very large data sets. Deep learning methods often achieve the latest results in a series of challenging areas such as machine translation, photo captioning, and speech recognition.

The implementation of neural networks involves the multiplication and addition of linear algebraic data structures. If extended to multiple dimensions, the deep learning approach can handle vectors, matrices, and even tensor inputs and coefficients, where the tensor is a two-dimensional matrix.

Linear algebra is the core of describing deep learning methods. It implements deep learning methods through matrix representations, such as Google's TensorFlow Python library, whose name contains the word “tensor”.

Garden Equipment

Garden Equipment,Garden Pond Water Pump,Low Voltage Pond Pumps,Swimming Pool Pump

Sensen Group Co., Ltd.   , https://www.sunsunglobal.com