Call Us Today! +1-(760)-642-5721|plagfreework@gmail.com
4.9

# 7144CEM Principles of Data Science

## Principles of Data Science Assignment help

Example: Flowers. Consider a particular variety of flower which can take one of three colours: red, white and pink. Suppose after each year, 40% of red flowers remain red but 60% of red flowers mutate to pink. For pink flowers, 30% mutate to red, 50% remain as pink, and 20% mutate to white. For white flowers, 90% remain as white and 10% mutate to pink. We can capture these probabilities in a transition matrix π where the columns correspond to red, pink and white flowers in the current year and the rows correspond to red, pink and white flowers in the next year. π=[0.40.300.60.50.100.20.9]

If a certain garden initially has 80 of this variety of red flowers and 20 of this variety of white flowers then after one year: π[80020]=[325018]

so we would expect to see 32 red, 50 pink and 18 white flowers in the garden. If we look at the garden after 5 years: πππππ[80020]=π5[80020]=[20.8837.0842.04]

so we would expect to see approximately 21 red, 37 pink and 42 white flowers in the garden. This is an example of a system called a βMarkov chainβ. The next state of the system depends only on its present state and does not depend on the earlier history of the system.
Car rental. Now consider a car rental agency that has offices in Paris, Berlin, Rome and Madrid. The agency allows one-way and two-way rentals so that cars in one city may end up in another. Statistics show that at the end of each week 70% of all rentals are two-way. As for one-way rentals: from Paris, 20% go to Berlin, 60% go to Rome, and the rest go to Madrid; from Berlin, 40% go to Madrid and 60% go to Rome; from Rome, 50% go to Madrid and the rest to Berlin; and from Madrid, 80% go to Rome, 10% go to Berlin, and 10% go to Paris.
(1) Construct a 4Γ4 transition matrix π (as a numpy array) to model this car rental agency as a Markov chain.
[10 marks]

(2) Suppose the agency starts the first week with 100 cars in each city (400 cars in total). Use numpy to calculate how many cars we would expect to see in each city at the end of each week for each of the following 15 weeks. Use Python to plot your results on a line graph showing one line for each city, together with a legend. Briefly comment on what you observe. You might find numpy.linalg.matrix_power() helpful.
[10 marks]

(3) Use numpy to find the eigenvectors of the transition matrix π from part (1), and explain how one of these eigenvectors is related to the number of cars we would expect to see in each city in the βlong-run steady stateβ. Also, for each city π, find the expected number of weeks for a particular car initially located at city π to first return to city π. Hint: if ππ is the probability that the particular car is in city π in the βlong-run steady stateβ then the expected first return time is given by 1/ππ.

By |2023-01-17T08:38:34+00:00January 17th, 2023|Categories: Information Technology||0 Comments