Machine learning: Homework: feature detection

The convolution product and feature detection #

Background #

Suppose that we have a function \(f : \mathbb{R} \rightarrow \mathbb{R} \). A common problem in machine learning is identifying locations on the graph of \(f\) where \(f \approx g \) for another function \(g\). We will call \(g\) a feature in the signal \(f\). To make this less abstract, consider the following signal:

Every so often, we can identify the presence of the following feature:

Without inspecting the signal manually, we would like to identify these locations in the domain. This is a fairly common problem. Consider a signal \(f\) that represents sound pressure wave in a room. A reasonably interesting feature \(g\) to look for may be the sound “Alexa.”

A proposed algorithm #

An algorithm is described below. Your job will be to analyze how well it works using a Python notebook. Suppose \(g\) represents a feature which we would like to locate in the signal \(f\). Here is the algorithm I would like you to analyze:

ALGORITHM FOR FEATURE LOCALIZATION 

0. Make sure that the feature is centered at x=0.
1. Reverse the function g, that is, let h(x) = g(-x)
2. Compute the convolution (f*h)(x)
3. Identify those x where the value of (f*h)(x) is high.
Homework exercise:

Follow the lab outlined in the Python notebook above. Write up your findings making sure to address the following points:

  • Detail how well the feature detection algorithm works in the two lab examples. Support your conclusion with data and images from the lab.

  • Explain why you expect this feature detection algorithm to work. Be as formal as you can and refer to the definition of the convolution in your work.

Hint: For the last part of the question, analyze the convolution product at points \(x\) where \(f\) matches \(g\) and points when it does not. An important observation is that a sound pressure wave is a rapidly oscillating function where oscillations occur around \(0\).