# When to use Convolutional Neural Networks (CNN)?

Get this book -> Problems on Array: For Interviews and Competitive Programming

Reading time: 15 minutes

Convolutional Neural Networks (CNNs) are designed to map image data (or 2D multi-dimensional data) to an output variable (1 dimensional data). They have proven so effective that they are the ready to use method for any type of prediction problem involving image data as an input.

The benefit of using CNNs is their **ability to develop an internal representation of a two-dimensional image**. This allows the model to learn position and scale in variant structures in the data which is important when working with images.

One can effectively use Convolutional Neural Network For:

- Image data
- Classification prediction problems
- Regression prediction problems

### Data with spatial relationship

In general, CNNs work well with data that has a **spatial relationship**.

The CNN input is traditionally two-dimensional, a field or matrix, but can also be changed to be one-dimensional, allowing it to develop an internal representation of a one-dimensional sequence.

This allows the CNN to be used more generally on other types of data that has a spatial relationship.

For example:

- There is an order relationship between words in a document of text
- There is an ordered relationship in the time steps of a time series.

Although not specifically developed for non-image data, CNNs achieve state-of-the-art results on problems such as **document classification** used in **sentiment analysis** and related problems.

Convolutional Neural Networks can be used on the following data as well:

- Text data
- Time series data
- Sequence input data