Question: PYTHON!!! I need to modify this document, I especially need to just finish the def test_timed_run(self) section. There is some instructions within that section of

PYTHON!!! I need to modify this document, I especially need to just finish the "def test_timed_run(self)" section. There is some instructions within that section of what I need done. This codes purpose is to produce some experimental data on the algorithms run time. Basically I will enter a number and it would give me a run time on that number that I entered. Everything I try doesn't work and am really stuck.

This is one piece that we have to code within the "def test_timed_run(self)" section:

For each size in the range [10 .. 200]: For each trial in the range [ 1 .. 6]: Generate random array of prices For each algorithm: Time the algorithm on the input just generated (and record the time) For each algorithm, compute the average for the set of 6 trials Display the average on console, or store the average 

PYTHON!!! I need to modify this document, I especially need to just

finish the "def test_timed_run(self)" section. There is some instructions within that section

of what I need done. This codes purpose is to produce some

Here is the MSA document:

experimental data on the algorithms run time. Basically I will enter anumber and it would give me a run time on that numberthat I entered. Everything I try doesn't work and am really stuck.

1 . 2 3 # ! /usr/bin/python3 #msa-experiments.py 6 #MSA : experiments from msa import* 9import unittest 10 import time 11 import numpy 12 import random as rd 13 import matplotlib.pyplot as plt 5 class MSA_Quantitative_Tests( unittest.TestCase) 16 A test class to be used as a container for quantitative tests " 19 _# Using a predefined seed so that the pseudo-random generator used to populate # the array . of . daily prices always produce the same set of values # random. seed (1) 21 23 I -'# size of the biggest test set 2 4 25 26 classmethod 27 28 -SIZE=200 generate_random >"" " " prices_crude (cls, size): generate random prices crude: 30 31 32 _A . simplistic .way . to .gene rate-daily . prices param size: the size of the array > : type-size: int 34 | >: return: . an, array, of, random, prices 35 36 37 38 39classmethod >->:rtype: . list - return tuple( random.randint (50,150) for day in range (size)) def generat te random prices (cls, size): 4 1 42 43 .._generate_random prices: Generate more realistic looking daily prices (with trends over several weeks) 4 6 47 48 49 param size: the size of the array. :type-size: . int : return :-an-array-of. random,prices typa: 1ist 51 MIN, MAX#50 , 150 53 days = list ( range( 0, size )) prices [ 0 for day in days ] ->_. 56 Level 1: Define long-term variations 1 . 2 3 # ! /usr/bin/python3 #msa-experiments.py 6 #MSA : experiments from msa import* 9import unittest 10 import time 11 import numpy 12 import random as rd 13 import matplotlib.pyplot as plt 5 class MSA_Quantitative_Tests( unittest.TestCase) 16 A test class to be used as a container for quantitative tests " 19 _# Using a predefined seed so that the pseudo-random generator used to populate # the array . of . daily prices always produce the same set of values # random. seed (1) 21 23 I -'# size of the biggest test set 2 4 25 26 classmethod 27 28 -SIZE=200 generate_random >"" " " prices_crude (cls, size): generate random prices crude: 30 31 32 _A . simplistic .way . to .gene rate-daily . prices param size: the size of the array > : type-size: int 34 | >: return: . an, array, of, random, prices 35 36 37 38 39classmethod >->:rtype: . list - return tuple( random.randint (50,150) for day in range (size)) def generat te random prices (cls, size): 4 1 42 43 .._generate_random prices: Generate more realistic looking daily prices (with trends over several weeks) 4 6 47 48 49 param size: the size of the array. :type-size: . int : return :-an-array-of. random,prices typa: 1ist 51 MIN, MAX#50 , 150 53 days = list ( range( 0, size )) prices [ 0 for day in days ] ->_. 56 Level 1: Define long-term variations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!