/// <summary> /// Samples the model parameters. /// </summary> /// <param name="K">K.</param> /// <param name="probInitPriorObs">Prob init prior obs.</param> /// <param name="cptTransPriorObs">Cpt trans prior obs.</param> /// <param name="emitMeanPriorObs">Emit mean prior obs.</param> /// <param name="emitPrecPriorObs">Emit prec prior obs.</param> /// <param name="trans">Trans.</param> /// <param name="emitMeans">Emit means.</param> /// <param name="emitPrecs">Emit precs.</param> /// <param name="init">Init.</param> /// <typeparam name="TEmitMean">The 1st type parameter.</typeparam> /// <typeparam name="TEmitPrec">The 2nd type parameter.</typeparam> private static void SampleModelParameters <TEmitMean, TEmitPrec>(int K, Sampleable <Vector> probInitPriorObs, IList <Dirichlet> cptTransPriorObs, IList <Sampleable <TEmitMean> > emitMeanPriorObs, IList <Sampleable <TEmitPrec> > emitPrecPriorObs, out double[][] trans, out TEmitMean[] emitMeans, out TEmitPrec[] emitPrecs, out double[] init) { init = probInitPriorObs.Sample().ToArray(); trans = new double[K][]; for (int i = 0; i < K; i++) { trans[i] = cptTransPriorObs[i].Sample().ToArray(); } emitMeans = new TEmitMean[K]; for (int i = 0; i < K; i++) { emitMeans[i] = emitMeanPriorObs[i].Sample(); } if (emitPrecPriorObs == null) { emitPrecs = default(TEmitPrec[]); return; } emitPrecs = new TEmitPrec[K]; for (int i = 0; i < K; i++) { emitPrecs[i] = emitPrecPriorObs[i].Sample(); } }
private void OnTriggerEnter(Collider other) { if (!other.GetComponent <Sampleable>()) { return; } sample = other.GetComponent <Sampleable>(); liquid.material.color = sample.Material.color; }
/// <summary> /// Samples the data. /// </summary> /// <param name="T">T.</param> /// <param name="initDist">Init dist.</param> /// <param name="transDist">Trans dist.</param> /// <param name="emitDist">Emit dist.</param> /// <param name="emissions">Emissions.</param> /// <param name="actualStates">Actual states.</param> /// <typeparam name="TEmit">The 1st type parameter.</typeparam> private static void SampleData <TEmit>(int T, Sampleable <int> initDist, IList <Sampleable <int> > transDist, IList <Sampleable <TEmit> > emitDist, out TEmit[] emissions, out int[] actualStates) { actualStates = new int[T]; emissions = new TEmit[T]; actualStates[0] = initDist.Sample(); emissions[0] = emitDist[actualStates[0]].Sample(); for (int i = 1; i < T; i++) { actualStates[i] = transDist[actualStates[i - 1]].Sample(); emissions[i] = emitDist[actualStates[i]].Sample(); } }
public static DomainType Random <DomainType>(Sampleable <DomainType> dist) { return(dist.Sample()); }
public void Start <TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine => _task = new Sampleable(stateMachine);
public static Action DelayedSampleInto <T>(Sampleable <T> sourceDist, HasPoint <T> targetDist) { return(delegate() { targetDist.Point = sourceDist.Sample(); }); }