Difference: RandGenDoc (1 vs. 2)

Revision 22018-04-27 - MichaelRiley

Line: 1 to 1
 
META TOPICPARENT name="FstQuickTour"

RandGen

Line: 11 to 11
 |
template <class Arc>
void RandGen(const Fst<Arc> &ifst, MutableFst<Arc> *ofst);
Changed:
<
<
| doc [bad link?] |
>
>
|
 |
template <class Arc, class ArcSelector>
void RandGen(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, const RandGenOptions<ArcSelector> &opts);
Changed:
<
<
| ^ |
>
>
|
 |
fstrandgen [--max_length=$l] [--npath=$n] [--seed=$s] [--select=$sel] in.fst out.fst 
Changed:
<
<
||
>
>
|
 

Example

Revision 12009-03-27 - CyrilAllauzen

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="FstQuickTour"

RandGen

Description

This operation randomly generates a set of successful paths in the input FST. The operation relies on an ArcSelector object for randomly selecting an outgoing transition at a given state in the input FST. The default arc selector, UniformArcSelector, randomly selects a transition using the uniform distribution. LogProbArcSelector randomly selects a transition w.r.t. the weights treated as negative log probabilities after normalizing for the total weight leaving the state. In all cases, finality is treated as a transition to a super-final state.

Usage

template <class Arc>
void RandGen(const Fst<Arc> &ifst, MutableFst<Arc> *ofst);
doc [bad link?]
template <class Arc, class ArcSelector>
void RandGen(const Fst<Arc> &ifst, MutableFst<Arc> *ofst, const RandGenOptions<ArcSelector> &opts);
fstrandgen [--max_length=$l] [--npath=$n] [--seed=$s] [--select=$sel] in.fst out.fst 

Example

A:

randgen1.png

Relabel(A, &B) using UniformArcSelector:

randgen2.png

RandGen(A, &B);
RandGen(A, &B, RandGenOptions<UniformArcSelector<Arc> >(UniformArcSelector<Arc>()));

fstrandgen a.fst b.fst

Relabel(A, &B) using LogProbArcSelector:

randgen3.png

RandGen(A, &B, RandGenOptions<LogProbArcSelector<Arc> >(LogProbArcSelector<Arc>()));

fstrandgen --select=log_prob a.fst b.fst

Complexity:

RandGen

  • Time: O(N * L * cT)
  • Space: O(N * L + cS)
where N = number of paths to be generated, L = expected length of a successful path according to the considered arc selector, cT = time required for randomly selecting an arc, and cS = space required for randomly selecting an arc.

-- CyrilAllauzen - 27 Mar 2009

META FILEATTACHMENT attachment="randgen1.png" attr="" comment="!RandGen example: input FST" date="1238180693" name="randgen1.png" path="randgen1.png" size="19869" stream="randgen1.png" tmpFilename="/var/tmp/CGItemp10755" user="CyrilAllauzen" version="1"
META FILEATTACHMENT attachment="randgen2.png" attr="" comment="!RandGen example: randomly generated path using =UniformArcSelector=" date="1238180730" name="randgen2.png" path="randgen2.png" size="7898" stream="randgen2.png" tmpFilename="/var/tmp/CGItemp10626" user="CyrilAllauzen" version="1"
META FILEATTACHMENT attachment="randgen3.png" attr="" comment="!RandGen example: randomly generated path using =LogProbArcSelector=" date="1238180810" name="randgen3.png" path="randgen3.png" size="7953" stream="randgen3.png" tmpFilename="/var/tmp/CGItemp10668" user="CyrilAllauzen" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback