Skip to main content

Questions tagged [markov-chain]

A stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event.

2 votes
1 answer
149 views

First order hidden Markov model with Viterbi algorithm in Java

Introduction A first order HMM (hidden Markov model) is a tuple \$(H, \Sigma, T, E, \mathbb{P})\$, where \$H = \{1, \ldots, \vert H \vert\}\$ is the set of hidden states, \$\Sigma\$ is the set of ...
coderodde's user avatar
  • 28.9k
5 votes
1 answer
231 views

Calculating the energy of the harmonic oscillator using a Monte Carlo method

The problem The partition function for the quantum harmonic oscillator can be written in the path integral formulation as $$Z\propto\int Dx(\tau)\exp\left(-\frac{S_E}{\hbar}\right)=\int Dx(\tau)\exp\...
My Code is a Flying Circus's user avatar
0 votes
1 answer
229 views

Monte Carlo simulation for the harmonic oscillator

Is there any improvement that can be made to the following code, written to simulate the harmonic oscillator in the path integral formulation with Monte Carlo methods? ...
My Code is a Flying Circus's user avatar
2 votes
0 answers
322 views

Python Markov Chain based pseudoword generator

This is a Python 3 module that generates random pronounceable word-like strings based on Markov Chains. It has many modes, each mode conforms to the structures of dictionary words to a degree, the two ...
Ξένη Γήινος's user avatar
3 votes
0 answers
78 views

Python program that analyzes a corpus for randomword generation

I play a lot of old-school western CRPGs, and most of them (if not all) require the player to generate an avatar at the start of a new game, including naming the character (with names that will never ...
Ξένη Γήινος's user avatar
2 votes
2 answers
338 views

Markov text generator program in Python

This is my first non-trivial program in my Python. I am coming from a Java background and I might have messed up or ignored some conventions. I would like to hear feedback on my code. ...
BovineScatologist's user avatar
4 votes
1 answer
604 views

Basic Markov Chain Algorithm

So I have a file(story.dat) with a randomly generated story like: "Sleeping in his car was never the plan but sometimes things don't work out as planned. This..." It will print out each word ...
GigaHiga's user avatar
15 votes
5 answers
4k views

Markov-chain sentence generator in Python

I wrote a Markov-chain based sentence generator as my first non-trivial Python program. I mainly used C before, so I probably have ignored a lot of Python conventions and features, so any advice would ...
Hashew's user avatar
  • 211
3 votes
2 answers
145 views

Simulation of an alien population

Background I've come across a puzzle (Problem 10 from this list of sample interview questions): One day, an alien comes to Earth. Every day, each alien does one of four things, each with equal ...
Motun's user avatar
  • 133
16 votes
1 answer
391 views

Solve the phase state between two haplotype blocks using markov transition probabilities

I have spent about more than a year in python, but I come from biology background. I should say I have got some understanding of for-loop and nested-for-loop to workout the solution to the problem I ...
everestial's user avatar
1 vote
0 answers
917 views

NodeJS Random sentence generator using Markov chain

Program generate sentences using Markov model and 3 text files Text file example: Antoine de Saint-Exupery, who was a French author, journalist and pilot wrote The Little Prince in 1943, one ...
Stepan Vanzuriak's user avatar
6 votes
1 answer
194 views

N state probability in an M/M/2 queue

I'm no ace when it comes to mathematical problems, so I've decided to go over some old college coursework and put it to code. The function works just fine and the returned values are spot on, but I'm ...
Luke's user avatar
  • 1,100
6 votes
1 answer
4k views

Hidden Markov Model with Viterbi

I have a Hidden Markov model class with basically a single method: getting the best parse of a sequence of input tokens based on Viterbi. While I have no hardcore benchmarks, I'd love some pointers ...
erip's user avatar
  • 926
6 votes
1 answer
179 views

Mark V. Shaney: a script to produce gibberish

What follows in an attempt at implementing Mark V. Shaney using contemporary Python. One question has already been asked while working on a generator in the code, but included here is the entire ...
Noctis Skytower's user avatar
38 votes
2 answers
5k views

Markov country name generator

I wrote a country name generator in Python 3.5. My goal was to get randomized names that would look as much like real-world names as possible. Each name needed to have a noun and an adjective form (e....
DLosc's user avatar
  • 485

15 30 50 per page