Package jline.lang.processes
Class MarkovChain
java.lang.Object
jline.lang.processes.Process
jline.lang.processes.MarkovChain
- All Implemented Interfaces:
Serializable
A class for a discrete time Markov chain
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMarkovChain(Matrix transMat) Creates a DTMC with the specified transition matrixMarkovChain(Matrix transMat, boolean isFinite) Creates a DTMC with the specified transition matrix and finite flag -
Method Summary
Modifier and TypeMethodDescriptionstatic MarkovChainCreate DTMC from sample system aggregation (legacy interface)static MarkovChainfromSampleSysAggr(Matrix samples) Create DTMC from sample system aggregationstatic MarkovChainfromSampleSysAggr(Matrix samples, int numStates) Create DTMC from sample system aggregationGet the state spaceGet the transition matrixbooleanisFinite()Check if the DTMC is finitestatic MarkovChainrand(int nStates) Create a random DTMCsample()Sample from the DTMCsample(int n) Sample n steps from the DTMC starting from initial distributionSample n steps from the DTMCvoidsetStateSpace(Matrix stateSpace) Set the state spacetoCTMC()Convert to CTMC by subtracting identity matrixGet time-reversed DTMC
-
Field Details
-
transMat
-
stateSpace
-
isfinite
protected boolean isfinite
-
-
Constructor Details
-
MarkovChain
Creates a DTMC with the specified transition matrix- Parameters:
transMat- the transition matrix
-
MarkovChain
Creates a DTMC with the specified transition matrix and finite flag- Parameters:
transMat- the transition matrixisFinite- whether the DTMC is finite
-
-
Method Details
-
toCTMC
Convert to CTMC by subtracting identity matrix- Returns:
- the equivalent CTMC
-
toTimeReversed
Get time-reversed DTMC- Returns:
- time-reversed DTMC
-
getTransMat
Get the transition matrix- Returns:
- the transition matrix
-
setStateSpace
Set the state space- Parameters:
stateSpace- the state space matrix
-
getStateSpace
Get the state space- Returns:
- the state space matrix
-
isFinite
public boolean isFinite()Check if the DTMC is finite- Returns:
- true if finite
-
sample
Sample from the DTMC -
sample
Sample n steps from the DTMC starting from initial distribution- Parameters:
n- number of steps to sample- Returns:
- matrix containing sampled states (column vector)
-
sample
Sample n steps from the DTMC- Parameters:
n- number of steps to samplepi0- initial state distribution (if null, uses uniform distribution)random- random number generator- Returns:
- matrix containing sampled states (column vector)
-
rand
Create a random DTMC- Parameters:
nStates- number of states- Returns:
- random DTMC
-
fromSampleSysAggr
Create DTMC from sample system aggregation- Parameters:
samples- matrix where each row is a sample trajectory, each column is a time step- Returns:
- DTMC constructed from samples by estimating transition probabilities
-
fromSampleSysAggr
Create DTMC from sample system aggregation- Parameters:
samples- matrix where each row is a sample trajectory, each column is a time stepnumStates- number of states (if -1, infer from data)- Returns:
- DTMC constructed from samples by estimating transition probabilities
-
fromSampleSysAggr
Create DTMC from sample system aggregation (legacy interface)- Parameters:
sa- the sample aggregation object- Returns:
- DTMC constructed from samples
-