Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Help out with this in Java and ensure it runs without any errors in VSCODE MarkovChain.java This class represents a Markov hain to produce

Please Help out with this in Java and ensure it runs without any errors in VSCODE

image text in transcribed

MarkovChain.java This class represents a Markov hain to produce a matrix of predicted future states using a state vector and a transition matrix. The class must have these private instance variables: - private Vector stateVector; - private Matrix transitionMatrix; The class must have the following public methods: - public Markovhain (Vector sVector, Matrix tMatrix): constructor - Initialize the instance variables with the given parameters - public boolean isValid () - Check if the instance variables are valid for a Markov chain problem and return a Boolean to indicate its validity (true if valid, false if invalid): Assignment 1 To be valid, the transition matrix must be a square (equal number of rows and columns) and that number must also match the number of columns in the state vector. Further, the sum of values in the state vector must equal 1.0 ("see note below) and the sum of values in each row of the transition matrix must equal 1.0 (*see note below) - public Matrix computeProbabilityMatrix (int numSteps) - First, call isValid() to see if this is a valid Markov chain. If not, return null immediately. Compute the probability matrix of this Markov chain after the given numSteps by multiplying the transition matrix by itself numSteps-1 times and multiplying the state vector by the resulting matrix. Note that you must multiply the state vector by the matrix and not the other way around. Return the resulting vector (note that it will technically be a Matrix object, not a Vector object, but it will be a 1-dimensional matrix with the same dimensions as the state vector). *Note: due to possible roundoff errors, checking if the sum is equal to 1.0 should not be done using == but rather checking if the value is very close to 1.0. For simplicity, you can check if the sum value is between 0.99 and 1.01

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions

Question

3. What are the current trends in computer hardware platforms?

Answered: 1 week ago