UncommonDistributions.java - Source Code Display - Jarvana. Search Browse Javadoc Search Javadoc Browse More Web Tutorials Java Source Code Display Archive: / org / apache / mahout / mahout-core / 0.3 / mahout-core-0.3-sources.jar File: org / apache / mahout / clustering / dirichlet /UncommonDistributions.java View Unformatted File /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.
Import org.apache.mahout.math.DenseVector; import org.apache.mahout.math.Vector; import org.uncommons.maths.random.GaussianGenerator; Statistics | About | Contact | Disclaimer Copyright © 2011 Code Strategies. Using Distributions to make a Gibbs sampler. Gibbs sampling is a statistical technique related to Monte Carlo Markov Chain sampling.
It is used to search a solution space for an optimal (or at least locally optimal solution). It is an iterative technique. Basically, a single parameter is chosen at random and the value of it is set to a random value (or one chosen from a distribution). All the other parameters remain the same. If the new solution is better than the old then it becomes the new model if not the old model is kept. Using biojava's org.biojava.bio.dist package it is very easy to construct a simple Gibbs aligner. The first class is the SimpleGibbsAligner.
SimpleGibbsAligner GibbsStoppingCriteria SimpleGibbsAlignerDemo. JGibbLDA: A Java Implementation of Latent Dirichlet Allocation (LDA) using Gibbs Sampling for Parameter Estimation and Inference. JGibbLDA A Java Implementation of Latent Dirichlet Allocation (LDA) using Gibbs Sampling for Parameter Estimation and Inference Copyright © 2008 by Xuan-Hieu Phan (pxhieu at gmail dot com), Graduate School of Information Sciences, Cam-Tu Nguyen (ncamtu at gmail dot com), , National University,
PS_cache/arxiv/pdf/1107/1107.3765v1.pdf. “Gibbs Sampling for the Uninitiated” for the Uninitiated. Recently via Twitter I came across “Gibbs Sampling for the Uninitiated” by Philip Resnik and Eric Hardisty, a tutorial that shows how to use Gibbs sampling of a Naive Bayes model to estimate the labels on a set of documents.
This paper goes through the algebra in great detail and concludes with pseudocode. Resnik and Hardisty do such a good job of making it look easy that I decided to write my own Gibbs sampler. It was, in fact, pretty easy. I wrote a Numeric Python script and put it in a github project called Naive Bayes Gibbs Sampler. Currently it just generates a small random corpus and runs over it for a few iterations, but the __main__ block makes it clear how this script could be used to do real work. Further improvements to be done in my copious spare time: That said, I hope this can be a useful addition to the tutorial. Like this: Like Loading... Wpm/Naive-Bayes-Gibbs-Sampler - GitHub.