liveBook · Manning

Vectorization

As explained in Deep Learning with R, Third Edition

Data vectorization is the conversion of input data or targets into numerical tensors suitable for neural-network processing.

Data vectorization converts inputs and targets into tensors that a neural network can process, typically floating-point tensors and sometimes integer or string tensors. It is one part of preprocessing, alongside normalization and handling missing values. section 6.2.1

The conversion depends on the data:

  • Text represented as sequences of word integers can be converted into floating-point tensors with multi-hot encoding. section 6.2.1
  • Some datasets, such as digit images and house-price features, may already be vectorized, so this step can be skipped. section 6.2.1
  • Vectorized array operations are a related but distinct idea: built-in operations process tensor entries efficiently, unlike element-by-element loops. section 2.3.1
z <- x + y  #1
z <- pmax(z, 0.)  #2

Use built-in array operations to add tensors and apply ReLU without writing nested loops. section 2.3.1

Vectorize data as part of the preparation workflow before developing a model. Domain-specific techniques for text and images require choices beyond these shared basics. section 20.1.5 section 6.2.1

How Deep Learning with R, Third Edition covers it

How deep it goes
Define tensor conversion and illustrate multi-hot encoding, but defer domain-specific preprocessing details for text and images.
Examples
Use multi-hot text encoding, already-vectorized digit and house-price data, and R array operations for addition and ReLU.
What you can do after
Apply data vectorization by converting raw inputs and targets into tensors and preprocessing them for neural-network use.
How it connects
Connect data vectorization to preprocessing, normalization, tensors, and neural networks.

Also explained in

Compare how 18 books explain vectorization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.