DATA MUNGING
DATA CLEANING PYTHON
MACHINE LEARNING RECIPES
PANDAS CHEATSHEET
ALL TAGS
# How to reduce dimentionality using PCA in Python?

# How to reduce dimentionality using PCA in Python?

This recipe helps you reduce dimentionality using PCA in Python

In [1]:

```
## How to reduce dimentionality using PCA in Python
def Snippet_123():
print()
print(format('How to reduce dimentionality using PCA in Python','*^82'))
import warnings
warnings.filterwarnings("ignore")
# load libraries
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn import datasets
# Load Digits Data And Make Sparse
digits = datasets.load_digits()
# Standardize the feature matrix
X = StandardScaler().fit_transform(digits.data)
print(); print(X)
# Conduct Principal Component Analysis
# Create a PCA that will retain 85% of the variance
pca = PCA(n_components=0.85, whiten=True)
# Conduct PCA
X_pca = pca.fit_transform(X)
print(); print(X_pca)
# Show results
print('Original number of features:', X.shape[1])
print('Reduced number of features:', X_pca.shape[1])
# Create a PCA with 2 components
pca = PCA(n_components=2, whiten=True)
# Conduct PCA
X_pca = pca.fit_transform(X)
print(); print(X_pca)
# Show results
print('Original number of features:', X.shape[1])
print('Reduced number of features:', X_pca.shape[1])
Snippet_123()
```

In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

There are different time series forecasting methods to forecast stock price, demand etc. In this machine learning project, you will learn to determine which forecasting method to be used when and how to apply with time series forecasting example.

Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

In this deep learning project, you will build a classification system where to precisely identify human fitness activities.

In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.