Tag Archives: Haskell

Lexicographical Ordering (60/365)

> import Data.Ord (comparing) This is completely random but I thought it was a neat use of laziness. You are familiar with lexicographical ordering? Haskell’s compare of lists implements this. ghci> [1,2] < [1,3] True ghci> [1,3,4] < [1,3,4,5] True … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

DSL for Generative Models (58/365)

I’ve now cleaned up (in befb0f3cca0c212e368497e86f030aa96355be18) the Reader and Writer interfaces and added it to Statistics.GModeling.Gibbs. I’ve removed references to Support and simply parameterized using a key type k and value type v. > data Reader k v = Reader … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

DSL for Generative Models (57/365)

I am putting together what I have so far in a repository here. So far, (133e22dc979d988706aafe52a346cee004f70ca5) it contains Statistics.GModeling.DSL Statistics.GModeling.Models.HMM Statistics.GModeling.Models.LDA Statistics.GModeling.Models.FixedTreeLDA Will continue building the pieces in upcoming posts.

Posted in Uncategorized | Tagged , , | Leave a comment

DSL for Generative Models – Interpreter (54/365)

The next step is for the library to have access to the latent variable data. I also don’t want the library to decide how to store the data because the user will have a much better idea of what is … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

DSL for Generative Models – Interpreter (53/365)

In this post, I write some functions to interpret the DSL. Specifically, I present some functions to figure out the children and parents of a node and discover what the prior, observed, and latent variables are. > import Control.Monad (msum) … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

DSL for Generative Models – Examples (52/365)

In the previous post I attempted to introduce a DSL for probabilistic models inspired by the plate notation. Let’s try to see if we can define LDA with it. > data LDALabels = Alpha | Beta | Topics | Topic … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

DSL for Generative Models (51/365)

The backlog becomes longer. I’ve changed jobs two weeks ago and it has upset my routine. No matter. Here we go again. I want to deviate from my problem solving mode for a while and use up a few posts … Continue reading

Posted in Uncategorized | Tagged , , | 1 Comment

Random Walk – Reading And Recall (34/365)

I said I wanted some awkward examples of random walks. After trying to shoehorn situations into a or movement, I think I have something. Consider the reading of a book. It’s an activity that proceeds in sequence as we read … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Modular Arithmetic (21/365)

In the paper Functional Pearl: Implicit Configurations, the authors use modular arithmetic as a running example to demonstrate the many ways of injecting the modulus into the arithmetic operations. For example, one approach is to explicitly pass around the modulus … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Reification And Reflection In Haskell (20/365)

I am reading the paper Functional Pearl: Implicit Configurations and I will go on to see how to use the hackage library reflection based on this paper which allows one to pass around configuration data in an elegant manner. Before … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment