Question: Can someone help me answer this problem please showing a step-by-step walk-through on how to solve this code with Comments throughout the code, please? can
Can someone help me answer this problem please showing a step-by-step walk-through on how to solve this code with Comments throughout the code, please? can this be done in Python-style code within a juypter notebook, can I ask that when you write your code to please double-check that it runs without any errors as well as I've been having trouble running code on here before and it is not working. With this being said can you type out your code so it's easier to follow/read thank you again in advance sorry for the long message.


[ ] \# Use this set of imports at the top of your code \# You can import other standard packages if needed \%matplotlib inline import matplotlib.pyplot as plt import numpy as np import numpy.random as rnd import pandas as pd Problem 7 Here you will write a simple class which will simulate a random process. The random process is a Poisson process with rate r1. In 5% of the samples, a second Poisson process with rate r2 is added. Poisson(r1)+Binomial(1,0.05)Poisson(r2) 1. Name the class TwoRateProcess. 2. The initilisation function should input two numbers: the rate r1 of the first process and the rate r2 of the second process. It should save them for use in the class. 3. Define a method . simulate that takes a number and generates that many samples of the distribution. Those samples should be saved in the class, adding to any existing samples. So if you run the function again, the new samples should be added to the end of the old samples. 4. Define a method .median that returns the median value of the samples generated. 5. Define a method .write_to_file which takes a filename and writes the samples to that file. There is code below which should work with your class. [ ] my_sim = TwoRateProcess (10,100) my_sim.simulate(1000) print(my_sim.median()) my_sim.simulate(5000) print(my_sim.median()) my_sim.write_to_file('test_file.txt' )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
