Package org.ptolemy.machineLearning.hsmm
Class HSMMGeneratorMultinomialEmissions
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- org.ptolemy.machineLearning.hsmm.HSMMGenerator
-
- org.ptolemy.machineLearning.hsmm.HSMMGeneratorMultinomialEmissions
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
HSMMTimeAwareGenerator
public class HSMMGeneratorMultinomialEmissions extends HSMMGenerator
This actor generates observation traces from an Explicit-Duration Hidden-Markov Model (EDHMM) with multinomial emissions and multinomial duration distributions.
- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Ilge Akkaya
- See Also:
HSMMParameterEstimator
,HSMMTimeAwareMultinomialEstimator
- Pt.AcceptedRating:
- Pt.ProposedRating:
- Red (ilgea)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected double[][]
_B
Multinomial emission probabilities per state.protected int[]
_nCategories
Number of categories.PortParameter
multinomialEstimates
A matrix that has a row for each state and a column for each category in the learned multinomial distribution.Parameter
nCategories
Number of categories in the multinomial distribution.PortParameter
powerLowerBound
A power lower bound on the generated trace, which applies to the entire generation window.-
Fields inherited from class org.ptolemy.machineLearning.hsmm.HSMMGenerator
_A, _D, _D0, _dt, _durationPriors, _firstIteration, _maxDuration, _nStates, _windowSize, _x0, _xt, D_new, durationPriors, durationProbabilities, hiddenState, MAX_TRIALS, observation, powerUpperBound, statePriors, transitionMatrix, trigger, windowSize
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description HSMMGeneratorMultinomialEmissions(CompositeEntity container, java.lang.String name)
Construct an actor with the given container and name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
_propagateState()
Sample next state given current state.protected int
_sampleDurationForState()
Sample a duration value given current state.protected int
_sampleDurationFromPrior()
Sample duration value from prior duration distribution.protected int
_sampleHiddenStateFromPrior()
Sample state at this iteration from the state prior.protected double[]
_sampleObservation()
Sample an observation value given current state.void
attributeChanged(Attribute attribute)
React to a change in an attribute.java.lang.Object
clone(Workspace workspace)
Clone the actor into the specified workspace.void
fire()
Do nothing.void
wrapup()
Do nothing except invoke the wrapup() methods of any objects that have been registered with addInitializable().-
Methods inherited from class org.ptolemy.machineLearning.hsmm.HSMMGenerator
preinitialize
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, initialize, removeInitializable
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
nCategories
public Parameter nCategories
Number of categories in the multinomial distribution.
-
powerLowerBound
public PortParameter powerLowerBound
A power lower bound on the generated trace, which applies to the entire generation window.
-
multinomialEstimates
public PortParameter multinomialEstimates
A matrix that has a row for each state and a column for each category in the learned multinomial distribution. if the observations are multidimensional, the categories for each dimension are concatenated into a single vector.
-
_B
protected double[][] _B
Multinomial emission probabilities per state.
-
_nCategories
protected int[] _nCategories
Number of categories.
-
-
Constructor Detail
-
HSMMGeneratorMultinomialEmissions
public HSMMGeneratorMultinomialEmissions(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Construct an actor with the given container and name.- Parameters:
container
- The container.name
- The name of this actor- Throws:
IllegalActionException
- If the actor cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
Description copied from class:NamedObj
React to a change in an attribute. This method is called by a contained attribute when its value changes. In this base class, the method does nothing. In derived classes, this method may throw an exception, indicating that the new attribute value is invalid. It is up to the caller to restore the attribute to a valid value if an exception is thrown.- Overrides:
attributeChanged
in classHSMMGenerator
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If the change is not acceptable to this container (not thrown in this base class).
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Description copied from class:TypedAtomicActor
Clone the actor into the specified workspace.- Overrides:
clone
in classHSMMGenerator
- Parameters:
workspace
- The workspace for the new object.- Returns:
- A new actor.
- Throws:
java.lang.CloneNotSupportedException
- If a derived class contains an attribute that cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
fire
public void fire() throws IllegalActionException
Description copied from class:AtomicActor
Do nothing. Derived classes override this method to define their primary run-time action.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- Not thrown in this base class.
-
wrapup
public void wrapup() throws IllegalActionException
Description copied from class:AtomicActor
Do nothing except invoke the wrapup() methods of any objects that have been registered with addInitializable(). Derived classes override this method to define operations to be performed exactly once at the end of a complete execution of an application. It typically closes files, displays final results, etc.- Specified by:
wrapup
in interfaceInitializable
- Overrides:
wrapup
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- Not thrown in this base class.
-
_sampleObservation
protected double[] _sampleObservation()
Description copied from class:HSMMGenerator
Sample an observation value given current state.- Specified by:
_sampleObservation
in classHSMMGenerator
- Returns:
- Observation
-
_sampleDurationForState
protected int _sampleDurationForState()
Description copied from class:HSMMGenerator
Sample a duration value given current state.- Specified by:
_sampleDurationForState
in classHSMMGenerator
- Returns:
- Duration
-
_propagateState
protected int _propagateState() throws IllegalActionException
Description copied from class:HSMMGenerator
Sample next state given current state.- Specified by:
_propagateState
in classHSMMGenerator
- Returns:
- Next state index.
- Throws:
IllegalActionException
-
_sampleHiddenStateFromPrior
protected int _sampleHiddenStateFromPrior()
Sample state at this iteration from the state prior.- Specified by:
_sampleHiddenStateFromPrior
in classHSMMGenerator
- Returns:
- The hidden state at this iteration
-
_sampleDurationFromPrior
protected int _sampleDurationFromPrior()
Description copied from class:HSMMGenerator
Sample duration value from prior duration distribution.- Specified by:
_sampleDurationFromPrior
in classHSMMGenerator
- Returns:
- sampled duration value
-
-