# compressNetworkUsingProjection

## Syntax

## Description

The `compressNetworkUsingProjection`

function reduces the
number of learnable parameters of layers by performing principal component analysis (PCA) of
the neuron activations using a data set representative of the training data and then projects
the learnable parameters into the subspace that maintains the highest variance in neuron
activations.

Forward passes of a projected deep neural network are typically faster when you deploy the network to embedded hardware using library-free C or C++ code generation.

If you prune or quantize your network, then use compression using projection after pruning and before quantization. Network compression using projection supports projecting LSTM layers only.

compresses the `netProjected`

= compressNetworkUsingProjection(`net`

,`mbq`

)`dlnetwork`

object `net`

by replacing
layers with projected layers. The function compresses layers by performing principal
component analysis (PCA) of the neuron activations using the data in the
`minibatchqueue`

object `mbq`

and projects learnable
parameters into the subspace that maintains the highest variance in neuron activations. This
function requires the Deep Learning Toolbox™ Model Quantization Library support package. This support package is a free add-on that you can download
using the Add-On Explorer. Alternatively, see Deep Learning Toolbox Model Quantization Library.

compresses the network using the data in the `netProjected`

= compressNetworkUsingProjection(`net`

,`X1,...,XN`

)`dlarray`

objects
`X1,...,XN`

, where `N`

is the number of network
inputs.

compresses the network using the `netProjected`

= compressNetworkUsingProjection(`net`

,`npca`

)`neuronPCA`

object
`npca`

. The PCA step can be computationally intensive. If you expect to
compress the same network multiple times (for example, when exploring different levels of
compression), then you can perform the PCA step up front using a `neuronPCA`

object.

`[`

also returns the structure `netProjected`

, `info`

] = compressNetworkUsingProjection(___)`info`

that contains information about the
reduction of learnable parameters and the explained variance achieved during
compression.

`[`

specifies additional options using one or more name-value arguments.`netProjected`

, `info`

] = compressNetworkUsingProjection(___,`Name=Value`

)

## Examples

## Input Arguments

## Output Arguments

## Extended Capabilities

## Version History

**Introduced in R2022b**