Re: Markov process representation

2006-03-16 Thread Max M
Jack Diederich wrote: > On Wed, Mar 15, 2006 at 04:50:31PM -0800, Paul Rubin wrote: > >>"kpp9c" <[EMAIL PROTECTED]> writes: >> >>>self._all_states |= set(key[i] for key in probabilities) >>>I am running: >>>Python 2.3 (#1, Sep 13 2003, 00:49:11) >> >>generator comprehensions are new in 2.4. T

Re: Markov process representation

2006-03-15 Thread kpp9c
hee hee works fine ... but kinda slow on my old machine... really time for a new laptop haha! still this code is so beautiful! *^-^* -- http://mail.python.org/mailman/listinfo/python-list

Re: Markov process representation

2006-03-15 Thread kpp9c
oh ... uhmm .. i don't follow what you are saying... where should i put those lines... should the import thing go on top? -- http://mail.python.org/mailman/listinfo/python-list

Re: Markov process representation

2006-03-15 Thread kpp9c
yes looking at this code i see a few things i haven't seem before. I am on Mac OS X 10.3.x and updating the python seems like a non trivial task at the moment.. i will try that and see where that gets me. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Markov process representation

2006-03-15 Thread Jack Diederich
On Wed, Mar 15, 2006 at 04:50:31PM -0800, Paul Rubin wrote: > "kpp9c" <[EMAIL PROTECTED]> writes: > > self._all_states |= set(key[i] for key in probabilities) > > I am running: > > Python 2.3 (#1, Sep 13 2003, 00:49:11) > > generator comprehensions are new in 2.4. Try: > >self._all_state

Re: Markov process representation

2006-03-15 Thread Paul Rubin
"kpp9c" <[EMAIL PROTECTED]> writes: > self._all_states |= set(key[i] for key in probabilities) > I am running: > Python 2.3 (#1, Sep 13 2003, 00:49:11) generator comprehensions are new in 2.4. Try: self._all_states |= set([key[i] for key in probabilities]) This does temporarily use more

Re: Markov process representation

2006-03-15 Thread kpp9c
try as i might i still get an error: File "markov.py", line 50 self._all_states |= set(key[i] for key in probabilities) I am running: Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin If that helps any... Thanks! -- http://mail.pytho

Re: Markov process representation

2006-03-15 Thread Scott David Daniels
kpp9c wrote: > This is wicked! I am trying to get it to work and am frantically fixing > tabs and spaces... It was cut and pasted from working code (which I pasted back to test). > but isn't line 50: > > self._all_states |= set(key[i] for key in probabilities) > > an error? isn't it supposed to

Re: Markov process representation

2006-03-15 Thread kpp9c
This is wicked! I am trying to get it to work and am frantically fixing tabs and spaces... but isn't line 50: self._all_states |= set(key[i] for key in probabilities) an error? isn't it supposed to be: self._all_states != set(key[i] for key in probabilities) -- http://mail.python.org/mailman/l

Markov process representation

2006-03-15 Thread Scott David Daniels
Here's one way (convert each set of transition percentages to a running sum up to one): import random class SingleStateMarkov(object): def __init__(self, probabilities, initial=None): self._states = states = sorted(probabilities) self._fromstate = dic