All pastes #835493 Raw Edit

Something

public text v1 · immutable
#835493 ·published 2007-12-28 22:05 UTC
rendered paste body
		System.out.println("Single datapoint example!");
		
		
		ExponentialState expState = new ExponentialState(); 
		
		expState.mean.set(new DoubleState(0.0)); 
		expState.datum.set(new DoubleState(10.0)); 
		
		/* */
		RandomSource randomSource = Distributions.randomSource();
		
		/*     */
		ExponentialDistribution ed = 
			Distributions.defaultFactory().exponentialWithRate(randomSource); 
		
		ScalarContinuousRateDensity scrd = new ScalarContinuousRateDensity(ed); 
		
		LetKernel muLetKernel = new LetKernel(new Path().add(new KeyPathElement(expState.mean)));
		DoubleDriftKernel muKernel = new DoubleDriftKernel(0.1);
		muLetKernel.subkernel.set(muKernel);

		// Configure the inference engine and sample
		SDK<ExponentialState> sdk = new SDK<ExponentialState>(expState, scrd, muLetKernel);
		int NUMSAMPLES = 100; 
		Walk<ExponentialState> engine = new Walk<ExponentialState>(sdk, Distributions.randomSource(), 
				new WalkControllerFixedLengthRun<ExponentialState>(NUMSAMPLES));
		engine.getSDK().declareQuery(
				new PeriodicQuery<ExponentialState>(
						new LogDensityReportingQuery<ExponentialState>(), 1));
		engine.go();