Question 13 write a python function called it should

• Lab Report
• 9
• 95% (157) 149 out of 157 people found this document helpful

This preview shows page 1 - 6 out of 9 pages.

Question 1.3 Write a Python function called simulate_observations . It should take no arguments, and it should return an array of 7 numbers. Each of the numbers should be the modified roll from one simulation. Then , call your function once to compute an array of 7 simulated modified rolls. Name that array observations On a modified roll of 20, Alice's action succeeded. .
In : modifier = 11 num_observations = 7 def simulate_observations(): """Produces an array of 7 simulated modified die rolls""" return np.random.choice(possible_rolls, num_observations) + modifier #SOLUTION observations = simulate_observations() #SOLUTION observations In [ ]: _ = ok.grade('q1_3') Question 1.4 Draw a histogram to display the probability distribution of the modified rolls we might see. Check with a neighbor or a TA to make sure you have the right histogram. In : # We suggest using these bins. . Out: array([16, 28, 18, 14, 27, 25, 23])
Question 1.5 Using that method, estimate modifier from observations . Name your estimate min_estimate . .
Question 1.6 Figure out a good estimate based on that quantity. Then , write a function named mean_based_estimator that computes your estimate. It should take an array of modified rolls (like the array observations ) as its argument and return an estimate of modifier based on those numbers. In [ ]: def mean_based_estimator(nums): """Estimate the roll modifier based on observed modified rolls in the array nums.""" return np.mean(nums) - 10 #SOLUTION # Here is an example call to your function. It computes an estimate # of the modifier from our 7 observations.
In [ ]: _ = ok.grade('q1_6')
2. Sampling Run the cell below to load the player and salary data. These two datasets also appear in Homework 4.
In : player_data = Table().read_table("player_data.csv") salary_data = Table().read_table("salary_data.csv") full_data = salary_data.join("PlayerName", player_data, "Name") # The show method immediately displays the contents of a table. # This way, we can display the top of two tables using a single cell. player_data.show(3) salary_data.show(3) full_data.show(3)
PlayerName Salary Age Team Games Rebounds Assists Steals Blocks Turnovers Points A.J. Price 62552 28 TOT 26 32 46 7 0 14 133 Aaron Brooks 1145685 30 CHI 82 166 261 54 15 157 954 Aaron Gordon 3992040 19 ORL 47 169 33 21 22 38 243 ... (489 rows omitted) Rather than getting data on every player, imagine that we had gotten data on only a smaller subset of the players. For 492 players, it's not so unreasonable to expect to see all the data, but usually we aren't so lucky. Instead, we often make statistical inferences
• • •
{"ft_lang_label":"__label__en","ft_lang_prob":0.6726322,"math_prob":0.84760857,"size":2636,"snap":"2022-05-2022-21","text_gpt3_token_len":712,"char_repetition_ratio":0.1356383,"word_repetition_ratio":0.014285714,"special_character_ratio":0.2833839,"punctuation_ratio":0.152,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9523188,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-01-25T18:09:33Z\",\"WARC-Record-ID\":\"<urn:uuid:d7e4087b-d12a-4fa2-9538-2668f07e21e8>\",\"Content-Length\":\"257554\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:1bdfa449-6156-4381-a2f0-d6205112563c>\",\"WARC-Concurrent-To\":\"<urn:uuid:d2c071b2-1f94-4ab8-be66-80482bc927e5>\",\"WARC-IP-Address\":\"104.17.93.47\",\"WARC-Target-URI\":\"https://www.coursehero.com/file/p17vn3l/Question-13-Write-a-Python-function-called-simulateobservations-It-should-take/\",\"WARC-Payload-Digest\":\"sha1:L7DURDV2H7RPJJ6FFS7WURYT62ZVKPFZ\",\"WARC-Block-Digest\":\"sha1:RWE3SJE4F5K2AIW2KF2KQP65GVT7UU3U\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-05/CC-MAIN-2022-05_segments_1642320304859.70_warc_CC-MAIN-20220125160159-20220125190159-00385.warc.gz\"}"}