# Parzen Window and Hyper-spherical window

The Parzen window, also known as the kernel density estimator, is a non-parametric method used for estimating the probability density function (PDF) of a random variable.

It uses various window shapes (e.g., rectangular, Gaussian, Epanechnikov, triangular) and assigns weights based on the chosen kernel function and the distance to the center of the window.

It is commonly used in pattern recognition, density estimation, and machine learning applications. The Parzen window allows us to estimate the underlying distribution of a dataset based on a set of observations.

## why do we use Parzen window?

- The Parzen window is used when the underlying distribution of data is unknown or difficult to model parametrically.
- It provides a flexible and non-parametric approach to estimate the probability density function.
- The method is particularly useful when dealing with data that may not conform to standard distributions or have complex patterns.

## How does Parzen window work?

- The Parzen window estimates the PDF by placing a window, usually a kernel function, at each data point and summing up the contributions of the windows to estimate the density at any given point.
- The width of the window (bandwidth) determines the smoothness of the estimated density. A smaller bandwidth results in a more detailed, localized estimation, while a larger bandwidth gives a smoother estimation.

Parzen window estimator:

𝑓̂(x) = (1/n) * Σ[ K((x — xi)/h) / h^d ]

- n is the total number of data points.
- K(u) is the kernel function, typically a probability density function (PDF) such as Gaussian.
- h is the bandwidth, which determines the width of the window.
- d is the dimensionality of the data.

# Hyperspherical window

The hyperspherical window uses a hypersphere as the window shape and assigns weights based on the radial basis function.

It is a technique where the data points are surrounded by a hypersphere (n-dimensional sphere) to estimate the density at a specific point.

It is useful when the underlying data distribution is expected to be concentrated within a certain radius around each data point.

This is one of the techniques used in KNN to cluster the data points that belong to a particular class.

Therefore, Hyperspherical window can be used for anomaly detection, clustering and generative modeling.