# Perceptual Path Length | Query

In Week 1, in the optional notebook of PPL, we have used Linear Interpolation to define PPL in w-space, and spherical interpolation to define PPL in z-space.

Also, in the notebook, it is mentioned that “Because you sample points in z from a Gaussian, we use spherical interpolation instead of linear interpolation to interpolate in z-space.

Can anyone tell me how does the distribution help to decide which type of interpolation to use in which space? Additionally, I also wanted to ask if the 8-layer perception network that is used as a mapping from z-w space in StyleGAN, has anything to do with it?

1 Like

Slerp is based on the fact that any point on the curve must be a [linear combination]of the ends. While Slerp interpolates along a great arc between two quaternions, it is also possible to interpolate along a straight line (in four-dimensional quaternion space) between those two quaternions.

Hey @cvetko.tim, thanks a lot for your reply. But do you mind breaking down your answer into a simpler version? I am not this well-rehearsed with Mathematics

Think of a sphere, like the Earth. You want to interpolate from one point (e.g. New York) to another (e.g. Tokyo).

You could either do it by going through the Earth (i.e. through its mantle and core), or by walking across the surface. (you couldn’t actually walk, but you get the idea)

The former would be linear interpolation, the latter would be spherical interpolation.

The StyleGAN paper [1] says

(…) spherical interpolation (…) is the most appropriate way of interpolating in our normalized input latent space.

citing [2], which is where spherical interpolation for latent space is introduced. [2] argues that linear interpolation might go through locations that are unlikely given the latent space’s high dimensionality and Gaussian prior.

Using our previous analogy, you are likely to find a person on the Earth’s surface but very unlikely to find anyone deep inside its core.

Check out section 2 of [2] for more info.

[1] Karras, Tero, Samuli Laine, and Timo Aila. “A style-based generator architecture for generative adversarial networks.” Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (2019)

[2] White, Tom. “Sampling generative networks.” arXiv preprint arXiv:1609.04468 (2016)

3 Likes

Thanks a lot @pedrorohde. An amazing explanation indeed, and a fun one too. Now, I will keep in mind that Journey to the center of the Earth is nothing but trying to implement Linear Interpolation while traveling from New York to Tokyo

2 Likes