In this blog, you will learn “What are Dimensionality reduction Techniques in Data Science?” Because of digitization, an enormous capacity of data is being produced through several zones such as sales, healthcare, organizations, production, and IoT devices.

Machine learning techniques are cast-off to reveal patterns and outlines between the attributes and features of this high dimensionality. Therefore, they can be cast-off to create forecasts that can be used by individuals at the executive level and medical practitioners to mark executive decisions.

Not all the features in the datasets produced are significant to train the machine learning algorithms. Some features may be irrelevant and some may not affect the result of the forecast. Removing or ignoring these less important or irrelevant features lessens the load on machine learning algorithms.

## What is Dimensionality Reduction Techniques

The number of input features, attributes, columns, or variables present in a specified dataset is stated as dimensionality, and the method to reduce these attributes or features is known as dimensionality reduction.

A dataset covers a massive number of input variables in many cases, which marks the prophetic modelling job more complex.

Since it is very problematic to visualize or make forecasts for the training dataset with a massive number of variables, for such circumstances, dimensionality reduction is essential to use.

These techniques of dimensionality reduction in data science and machine learning are broadly used for gaining a well fit prophetic model while resolving the regression and classification complications.

## Why Dimensionality Reduction?

In machine learning, to clip useful signs and find a more perfect outcome, at first, we tend to increase as many attributes as possible. But, after a specific data point, the presentation of the model will decline with the adding number of features. This process is stated as the curse of dimensionality.

The curse of dimensionality happens because of the sample density losses with the rise of the features.

When we keep increasing features without growing the number of training dataset samples as well, the dimensionality of the feature space raises and turn sparser and sparser. Because of this sparsity, it comes to be much easier to discover a perfect result for the machine learning model which very probable leads to overfitting.

Overfitting occurs when the model resembles too closely a specific dataset and does not simplify well. An overfitted model will work very well only on the training dataset so that it goes pear-shaped on the future datasets and makes the forecast untrustworthy.

Thus, how can we overwhelmed the curse of dimensionality and escape overfitting particularly when there are many features? Dimensionality reduction techniques in data science are widely used to solve these complications.

## Approaches of Dimension Reduction

There are two approaches to apply the dimension reduction techniques in data science, which are given below:

### Feature Selection

Feature selection is the method of choosing the subclass of the related features and removing the irrelevant attributes existing in a dataset to construct an efficient model. For the feature selection, three methods are castoff that are following

#### 1. Filters Methods

The given datasets are filtered, in this method, and a subclass that comprises only the relevant attributes is chosen. Some common techniques of filters method are ANOVA, Chi-Square Test, Correlation, and Information Gain, etc.

#### 2. Wrappers Methods

The wrapper method works the same as the filter method, but it takes a model of machine learning for its assessment. Some features are provided to the ML model, in this method, and assess the performance.

The performance chooses whether to add those given features or eliminate them to rise the correctness of the model. This method is more perfect than the filtering method.

For wrapper methods, some popular techniques are Backward Selection, Forward Selection, and Bi-directional Elimination.

#### 3. Embedded Methods

In the machine learning model, embedded methods check the diverse training repetitions and evaluate the significance of each feature or variable. Few common techniques of embedded methods are Elastic Net, LASSO, and Ridge Regression, etc.

## Feature Extraction:

Feature extraction is the method of transmuting the space holding many features into space with fewer features. This approach is valuable when you need to save the complete information but use a smaller amount of means while treating the information. Some common feature extraction techniques are Linear Discriminant Analysis, Principal Component Analysis, Quadratic Discriminant Analysis, and Kernel PCA .

## Machine Learning Dimensionality Reduction Techniques| Common Techniques

There are many dimensionality reduction techniques in data science, out of which, the most commonly used are the following:

### Principal Component Analysis (PCA)

Principal Component Analysis (PCA) is a statistical method that alters the observations of interrelated attributes into a set of linearly non-correlated attributes with the assist of orthogonal transformation. These new altered attributes are known as the Principal Components.

It is one of the widely held tools that are cast off for experimental data analysis and projecting modelling. Principal Component Analysis (PCA) does work by allowing for the alteration of each feature since the high feature displays the good splitting between the classes, and, therefore, it lessens the dimensionality. Usually, in the case of a hold-out dataset, we would use a PCA on the training data to reduce the number of dimensions.

### Backward Feature Elimination

The backward feature elimination method is mostly castoff while building logistic regression or linear regression model. The following steps are implemented in this method to decrease the dimensionality (linear dimensionality reduction): In this method, first, all the n variables or features of the specified dataset are reserved to train the classical.

The presentation of the classical is evaluated. Now we will eliminate one attribute every time and train the classical on n-1 attributes for n times and will calculate the performance of the classical. We will check the feature that has made the minimum or no variation in the presentation of the classical, and then we will drop that features after that.

Repeat the whole method till no variable can be dropped. In this method, by selecting the optimal performance of the classical and maximum bearable error rate, we can express the ideal number of attributes need for the machine learning algorithms.

### Forward Feature Selection

Forward feature selection follows the opposite route of the backward elimination method. It means, in this method, we do not remove the attributes instead, we will discover the finest attributes that can produce the maximum growth in the performance of the classical. Below phases are accomplished in this method:

- We begin with a single attribute only, and gradually we will add each attribute at a time.

- Here we have to train the classical on each attribute individually.

- The attribute with the greatest performance is nominated.

- The method will be reiterated until we develop an important increase in the performance of the classical.

### Missing Value Ratio

If a dataset contains too many missing values, then we leave that dataset because it does not contain much valuable information. To do this, we can fix a threshold level, and if a feature has missing values more than that edge, we will leave that feature. The greater the threshold value, the more proficient the reduction.

### Low Variance Filter

The low variance filter is the same as the missing value ratio method, data columns with some variations in the data have a smaller amount of information. Hence, we want to compute the alteration of each variable, and all data columns with alteration lesser than an assumed threshold are left because low variance attributes will not influence the target variable.

### High Correlation Filter

High Correlation states to the circumstance when two attributes bring almost similar information. Due to this aspect, the performance of the classical can be degraded.

This correlation between the self-determining numerical attributes provides the calculated value of the correlation coefficient. If this value is greater than the threshold value, we can eliminate one of the attributes from the dataset. We can think through those attributes or features that display a high correlation with the target variable.

### Factor Analysis

Factor analysis is one of the techniques in which each attribute is set aside within a class with other variables, according to the correlation, means attributes inside a class can have in height correlation between themselves, but, on the other hand, they have a low correlation with attributes of other classes.

We understand it through an example. Suppose, we have two features Income and spend. These two features have a high correlation, which means people with extraordinary income spend more.

So, such features are put into a class, and that class is identified as the factor. The number of these aspects will decrease as compared to the original features of the dataset.

### Auto-encoders

One of the general techniques is auto-encoder, which is a category of artificial neural network ANN, and the main aim of auto-encoder is to copy the inputs values to their outcomes. In this way, the input is packed down into a latent-space demonstration, and the outcome is happened using this demonstration.

Auto-encoder has generally two parts:

**Encoder**: The purpose of the encoder is to do compress the input to practice the latent-space demonstration.

**Decoder**: The purpose of the decoder is to reconstruct the output from the latent-space demonstration.

## Real-time Example

### Email Classification

Suppose that you have an email’s database, and you need to organize each email as spam or not spam. To accomplish this goal, you make a mathematical demonstration of every email as a bag of words vectors. This vector a binary vector, where each point links to a particular word from a letter of the alphabet. One and all entry in the bag of words vectors, for an email, is the number of times a matching word looks in an email.

Suppose you have built a bag of words from every email, and as an outcome, you have a model of a bag of words vectors x_{1, }x_{2}…. X_{m}. But, not all patterns of words of your vectors are helpful for the spam or not spam sorting.

For instance, words “pay”, “lottery”, “credit” will be better attributes for spam classification than “tree”, “cat”, “dog”. We will use PCA as a mathematical method to decrease dimension.

You will build an m-by-m covariance matrix, for PCA, from your sample x_{1, }x_{2}…. X_{m} and calculate its eigenvalues and eigenvectors. Then, sort the resultant numbers in a declining order and select top p eigenvalues.

Put on PCA to your vectors sample is projecting them onto eigenvectors parallel to top p eigenvalues. Now, your resultant data is the prediction of original data on eigenvectors p, and the features of projected data have been lessened p.

## Advantages of Dimensionality Reduction Techniques

Some advantages of applying these techniques in data science to the given dataset are the following: By decreasing the dimensions of the attributes, the space needed to store the dataset also gets decreased. A less amount of calculation training time is required to reduce the dimensionality.

Fewer dimensions of attributes of the dataset assist in visualizing the data faster. It eliminates the Dictionary features by taking care of multiple correlation and regression.

## Disadvantages of Dimensionality Reduction Techniques

Some disadvantages of applying these techniques in data science to the given dimensional dataset are the following: More or fewer data may be lost because of dimensionality reduction. In the Principal Component Analysis (PCA), sometimes the main components need to consider unknown. You may not know that how many major components need to keep in practice.

## Conclusion

Dimensionality reduction techniques in data science can assist you to escape many problems. The key technique can be cracked down into two main key categories; feature selection and feature extraction. The technique that will work well relies on your specific dataset and business purposes, however, These techniques can be outstanding data preparation methods, particularly when working with enormous datasets.