# Filters

By for September 2, 2014

Report Abuse
Sample Experiment to demonstrate the use of various filtering modules available in Azure ML.
#Filters In this experiment, we will demonstrate how to use the filtering modules provided in Azure ML Studio. ##Experiment Creation The experiments has these three main steps: - [Step 1: Creating a synthetic dataset] - [Step 2: Applying the filters] - [Step 3: Visualizing using R] [Step 1: Creating a synthetic dataset]:#step-1-get-data [Step 2: Applying the filters]:#step-2 [Step 3: Visualizing using R]:#step-3 ### Step 1: Creating a synthetic dataset To illustrate how the digital signal processing filters in Azure ML work, it is easiest to construct a synthetic dataset. We created this dataset by using R to write a function that superimposes a sine wave of a higher frequency on a sine wave of a lower frequency. You can also engineer composite sine waves easily in Excel by using a formula such as y = a cos(x-A) + b cos(x-B). ### Step 2: Applying the filters Using this dataset, we applied the following types of filters that are provided in Azure ML. 1. [Moving Average Filter](http://en.wikipedia.org/wiki/Moving_average): We applied a simple moving average over a window of length 20. Other possible options available in this module are documented [here](http://help.azureml.net/Content/html/1889e4ca-7bf7-494d-b2cc-da9940468b9e.htm) 2. [Threshold Filter](http://help.azureml.net/Content/html/1889e4ca-7bf7-494d-b2cc-da9940468b9e.htm): To demonstrate the use of threshold filters, here we assigned 0 to any value less than 0. 3. [Median Filter](http://help.azureml.net/Content/html/a7974d98-616d-4a78-8966-cad384b41886.htm): This filter outputs the running median of a window of size 20 over the input dataset. 4. [User Defined Filter](http://help.azureml.net/Content/html/53f113fe-2e9d-45dd-a421-cdd7ada0567b.htm): In this custom filter, we provided coefficients for a finite impulse response (FIR) filter, which computes the exponential moving average over a window of size 20. 5. [Finite Impulse Response (FIR) Filter](http://en.wikipedia.org/wiki/Finite_impulse_response): This example uses a low pass FIR filter. There are many other options, documented in the module reference [here](http://help.azureml.net/Content/html/5bcfd02b-e359-4289-b75c-3aa9f3e4479f.htm) . For example, you can compute a low pass, high pass, band pass and a band stop filter. 6. [Infinite Impulse Response (IIR) Filter](http://en.wikipedia.org/wiki/Infinite_impulse_response): Here we demonstrated the effects of using a low pass IIR filter. This module is documented [here](http://help.azureml.net/Content/html/1c22cafc-1da0-4dc5-9336-831ee3f2860b.htm) and has many options, including low pass, high pass, band pass and band stop filters. ![image1][image1] ![image2][image2] ![image3][image3] ![image4][image4] After you have configured the filters, you apply it to the data using the **Apply Filter** module. You must also specify the dataset to be filtered. ### Step 3: Visualizing using R We joined the filtered data to the original data using the **Add Columns** module. The output of **Add Columns** is input to an instance of **Execute R Script**, which we use to plot the original data and the filtered output. ![image6][image6] For example, the output of **Moving Average Filter** looks as follows: ![image7][image7] The final experiment looks like this: ![image5][image5] <!-- Images --> [image1]:http://az712634.vo.msecnd.net/samplesimg/v1/20/moving_average.png [image2]:http://az712634.vo.msecnd.net/samplesimg/v1/20/threshold.png [image3]:http://az712634.vo.msecnd.net/samplesimg/v1/20/median.png [image4]:http://az712634.vo.msecnd.net/samplesimg/v1/20/user_defined.png [image5]:http://az712634.vo.msecnd.net/samplesimg/v1/20/full_experiment.png [image6]:http://az712634.vo.msecnd.net/samplesimg/v1/20/executeR.png [image7]:http://az712634.vo.msecnd.net/samplesimg/v1/20/moving_average_output.png