Package com.softsynth.jmsl.util
Class MarkovObjectChooser
java.lang.Object
com.softsynth.jmsl.util.MarkovObjectChooser
public class MarkovObjectChooser
extends java.lang.Object
First order Markov table and Markov Chain generator
- Author:
- Nick Didkovsky, nick@didkovsky.com
-
Constructor Summary
Constructors Constructor Description MarkovObjectChooser()
-
Method Summary
Modifier and Type Method Description java.lang.Object
chooseUniformRandomObject()
void
incTransitionProbability(java.lang.Object fromObj, java.lang.Object toObj)
Increase the transition weight from fromObj to toObj by 1.static void
main(java.lang.String[] args)
java.lang.Object
next(java.lang.Object fromObj)
void
setTransitionProbability(java.lang.Object fromObj, java.lang.Object toObj, double prob)
Set the likelihood that toObj will follow fromObjMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MarkovObjectChooser
public MarkovObjectChooser()
-
-
Method Details
-
setTransitionProbability
public void setTransitionProbability(java.lang.Object fromObj, java.lang.Object toObj, double prob)Set the likelihood that toObj will follow fromObj -
incTransitionProbability
public void incTransitionProbability(java.lang.Object fromObj, java.lang.Object toObj)Increase the transition weight from fromObj to toObj by 1. Useful for building up transition states from an input sequence. If you use this, don't use setTransitionProbability(). If transition did not already exist, it is created -
next
public java.lang.Object next(java.lang.Object fromObj)- Returns:
- Object chosen using transition probabilities from fromObj, or null if no transition state exists
-
chooseUniformRandomObject
public java.lang.Object chooseUniformRandomObject() -
main
public static void main(java.lang.String[] args)
-