/** Test of setRandom method, of class LatentDirichletAllocationVectorGibbsSampler. */ @Test public void testSetRandom() { LatentDirichletAllocationVectorGibbsSampler instance = new LatentDirichletAllocationVectorGibbsSampler(); assertNotNull(instance.getRandom()); Random random = new Random(); instance.setRandom(random); assertSame(random, instance.getRandom()); random = new Random(); instance.setRandom(random); assertSame(random, instance.getRandom()); random = null; instance.setRandom(random); assertSame(random, instance.getRandom()); random = new Random(); instance.setRandom(random); assertSame(random, instance.getRandom()); }
/** Test of constructors of class LatentDirichletAllocationVectorGibbsSampler. */ @Test public void testConstructors() { int topicCount = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_TOPIC_COUNT; double alpha = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_ALPHA; double beta = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_BETA; int maxIterations = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_MAX_ITERATIONS; int burnInIterations = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_BURN_IN_ITERATIONS; int iterationsPerSample = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_ITERATIONS_PER_SAMPLE; LatentDirichletAllocationVectorGibbsSampler instance = new LatentDirichletAllocationVectorGibbsSampler(); assertEquals(topicCount, instance.getTopicCount()); assertEquals(alpha, instance.getAlpha(), 0.0); assertEquals(beta, instance.getBeta(), 0.0); assertEquals(maxIterations, instance.getMaxIterations()); assertEquals(burnInIterations, instance.getBurnInIterations()); assertEquals(iterationsPerSample, instance.getIterationsPerSample()); assertNotNull(instance.getRandom()); topicCount = 1 + random.nextInt(100); alpha = random.nextDouble() * 10.0; beta = random.nextDouble() * 10.0; maxIterations = 1 + random.nextInt(100000); burnInIterations = random.nextInt(1000); iterationsPerSample = random.nextInt(100); instance = new LatentDirichletAllocationVectorGibbsSampler( topicCount, alpha, beta, maxIterations, burnInIterations, iterationsPerSample, random); assertEquals(topicCount, instance.getTopicCount()); assertEquals(alpha, instance.getAlpha(), 0.0); assertEquals(beta, instance.getBeta(), 0.0); assertEquals(maxIterations, instance.getMaxIterations()); assertEquals(burnInIterations, instance.getBurnInIterations()); assertEquals(iterationsPerSample, instance.getIterationsPerSample()); assertSame(random, instance.getRandom()); }