In this assignment your goal is to write a python program


Assignment -

The pattern detection problem - In this assignment, your goal is to write a python program to determine whether a given pattern appears in a data series, and if so, where it is located in the data series. This type of problems is very common in many disciplines, including computer science, engineering, medicine and science. There are many different types of pattern detection problems, the setting of this assignment is similar to that used in radars. A radar transmits a pulse of a specific shape and waits for a pulse of similar shape to return, in order to determine the position of an object. The method described below is known as matched filtering and is widely used in communication systems. This means your mobile phones perform the same type of calculations that you will be programming below!

Learning objectives - By completing this assignment, you will learn:

1. To apply programming concepts of variable declaration, constant declaration, assignment, selection and iteration (for loop).

2. To translate an algorithm described in a natural language to a computer language.

3. To organize programs into smaller modules by using functions.

4. To use good program style including comments, meaning variable names and others.

5. To get a practice on software development, which includes incremental development, testing and debugging.

Implementation Requirements -

You need to implement the following four functions, each in a separate file (provided). You need to submit these four files, each containing one function you implement.

1. def calculate_similarity(data segment, pattern):

  • The aim of this function is to calculate the similarity measure between one data segment and the pattern.
  • The first parameter idata_segment is a list of (float) values, and the second parameter 'pattern' is also a list of (float) values. The function calculates the similarity measure between the given data segment and pattern and returns the calculated similarity value (float), as described earlier in this assignment. The function returns "Error" if 'data_segment' and 'pattern' have different lengths.
  • This function can be tested using the file 'test_calculate_similarity.py'.

2. def calculate_similarity_list(data series, pattern):

  • The aim of this function is to calculate the similarity measures between all possible data segments and the pattern.
  • The first parameter 'data_series' is a list of (float) values, and the second parameter 'pattern' is also a list of (float) values. The function calculates the similarity measures, using the above function 'calculate_similarity', of all possible data segments in a sequence, and returns the list of calculated similarity values.
  • This function can be tested using the file 'test_calculate_similarity_list.py'.

3. def pattern_search_max(data series, pattern, threshold):

  • The three possible outcomes are "Insufficient data", "Not detected" and the location of the pattern if the pattern is found in the data series. Here, the location of the pattern refers to the index of the highest similarity measure that is also greater than or equal to the given threshold value.
  • The first parameter 'data_series' is a list of (float) values, the second parameter 'pattern' is a list of (float) values, and the third parameter 'threshold' is a (float) value. In this function, you need to use the function icalculate_similarity_list.
  • This function can be tested using the file 'test_pattern_search_max.py'.

4. def pattern_search_multiple(data series, pattern_width, threshold):

The three possible outcomes are "Insufficient data", "Not detected" and a list of non overlapping indices that are greater than or equal to the given threshold value, and that satisfy the following criteria:

  • an index is not selected if the value at the index is less than a value at one of it's overlapping indices.
  • an index is not selected if it is overlapping with first or last index.

We say two indices are overlapping if the distance between them is less than the width of the pattern.

The first parameter 'data_series' is a list of (float) values, the second parameter 'pattem_width' is a (float) value, and the third parameter 'threshold' is a (float) value.

This function can be tested using the file 'test_pattern_search_multiple.py'.

Attachment:- Assignment Files.rar

Request for Solution File

Ask an Expert for Answer!!
Python Programming: In this assignment your goal is to write a python program
Reference No:- TGS02750354

Expected delivery within 24 Hours