. My sole purpose is to
test the predicting power of an HMM, given a set of
parameter values.
I will definitely try out your snippet and see if it
works. Thanks a lot!
--- Alex Martelli [EMAIL PROTECTED] wrote:
Anthony Liu [EMAIL PROTECTED] wrote:
...
As a matter of fact, given that we
I am at my wit's end.
I want to generate a certain number of random numbers.
This is easy, I can repeatedly do uniform(0, 1) for
example.
But, I want the random numbers just generated sum up
to 1 .
I am not sure how to do this. Any idea? Thanks.
of fact, given that we have to specify the
number of states for an HMM, I would like to create a
specified number of random floating numbers whose sum
is 1.0.
--- Edward Elliott [EMAIL PROTECTED] wrote:
Anthony Liu wrote:
But, I want the random numbers just generated sum
up
to 1
Hi, Dave,
That looks nice, I'll definitely try it out.
--- Dave Hansen [EMAIL PROTECTED] wrote:
On Tue, 18 Apr 2006 08:17:22 -0700 (PDT) in
comp.lang.python, Anthony
Liu [EMAIL PROTECTED] wrote:
--- bayerj [EMAIL PROTECTED] wrote:
Hi,
1 2 3 4 5
0 7 8 9
Hi, Bayer Munich,
I implemented a syntax parser from bottom up using a
CNF grammar.
I actually know what part of the triangle of the
matrix I need to turn into a tree, but it is kinda
hard to describe in text.
So, I just made it easy by giving a triangle of the
matrix.
Anyway, thanks for your
--- bayerj [EMAIL PROTECTED] wrote:
Hi,
1 2 3 4 5
0 7 8 9 10
0 0 13 14 15
0 0 0 19 20
0 0 0 0 25
Look at the triangle represented by the non-zero
integers. This triangle is a binary tree if we
take 5
as the root and walk down on both
I am using numarray.
Suppose I have
p = array(range(25), shape=(5,5))
p
array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]])
How do I easily slice out [0,1,2] or [1,2,3] or
[2,7,12] or [7,12,17] and
Hi, Robert,
Thanks a lot.
I figure it out, too. NumArray is so flexible, it's
like cutting the cheese. You can cut it anyway you
want. I really like NumArray.
--- Robert Kern [EMAIL PROTECTED] wrote:
Anthony Liu wrote:
I am using numarray.
I will be using numpy for this post
Hi, James,
I just realized that my English is so good that I can
joke with slangs. Hopefully it isn't that offensive.
Otherwise, I am sorry.
--- James Stroud [EMAIL PROTECTED] wrote:
Anthony Liu wrote:
I figure it out, too. NumArray is so flexible,
it's
like cutting the cheese.
Some
There are many ways to represent a binary tree on an
ascii screen.
1
/ \
2 3
/ \ / \
4 5 6 7
or
4---2---1
| |
56- 3
|
7
Suppose I have a function that takes a matrix like
this
I am talking about the 'take' method of numarray.
See here for more info:
http://stsdas.stsci.edu/numarray/Doc/node33.html
If I initialize a matrix 'mymatrix' by zeros((3,3),
type=Float64), I get a 3*3 matrix of all zeros.
Look:
from numarray import *
mymatrix = zeros((3,3), type=Float64)
Thanks, Tim, that is really cool. I know there must
be some convenient way of doing this.
--- Tim Hochberg [EMAIL PROTECTED] wrote:
Anthony Liu wrote:
I am talking about the 'take' method of numarray.
See here for more info:
http://stsdas.stsci.edu/numarray/Doc/node33.html
I downloaded and built the python/c++ maxent package (
http://homepages.inf.ed.ac.uk/s0450736/maxent_toolkit.html
).
I don't know what happened, the interpreter cannot
find the cmaxent module, whereas cmaxent.py is right
under the current directory.
from maxent import *
cmaxent module not
First of all, thank all of you who guided me through
the readline library for enabling bash-like python
interpreter. This has been taken care of nicely.
I am trying to use the maxent package written by Zhang
Le from here:
http://homepages.inf.ed.ac.uk/s0450736/maxent_toolkit.html#download
The
That is, at the Python interactive mode, if I hit the
upper arrow key, it'll bring up the last line of code.
At
http://groups.google.com/group/comp.lang.python/browse_thread/thread/fb8c2fd9eed0d/736fac8c33e84d0c?lnk=stq=python+%22upper+arrow%22rnum=2hl=en#736fac8c33e84d0c
, it seems that Michael
to install the readline module. I
tried what was suggested from the newsgroup, but got
an error at make:
make: *** [Modules/readline.o] Error 1
Thanks
--- Carl Friedrich Bolz [EMAIL PROTECTED] wrote:
Anthony Liu wrote:
That is, at the Python interactive mode, if I hit
the
upper arrow key
We know that if we do
print '\a'
the bell will sound.
Now, why do I hear the sound on my local machine when
I run a python script on a remote host?
I understand if I hear it when I do
print '\a'
on my local machine.
Does the command get sent back to the client machine?
Thanks.
I have this simple string:
mystr = 'this_NP is_VL funny_JJ'
I want to split it and give me a list as
['this', 'NP', 'is', 'VL', 'funny', 'JJ']
1. I tried mystr.split('_| '), but this gave me:
['this_NP is_VL funny_JJ']
It is not splitted at all.
2. I tried mystr.split('_'), and this gave
I believe that topic related to Chinese processing was
discussed before. I could not dig out the info I want
from the mail list archive.
My Python script reads some Chinese text and then
split a line delimited by white spaces. I got lists
like
['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2',
Hi,
I think I got confused by the python import facility.
Say, in code1.py I have func1, func2, func3 and main.
In code2.py, I *only* want to use func2 from code1.py.
So, I did
from code1 import func2
But every time, I run code2.py, the main() of code1.py
is run.
I don't know why. Any hint
--- Michael Soulier [EMAIL PROTECTED] wrote:
On 4/19/05, Anthony Liu [EMAIL PROTECTED]
wrote:
But every time, I run code2.py, the main() of
code1.py
is run.
You probably did not protect your main function in
both modules.
ie.
if __name__ == '__main__': main()
You
, Anthony Liu [EMAIL PROTECTED]
wrote:
You are certainly right, because I don't know how
to
protect the main functions. Where do I put
if __name__ == '__main__': main()
I just glanced in the modules section of the python
documentation and
surprisingly this is not mentioned at all
of code1.py
module the following,
if __name__ == __main__:
main()
I should be OK, right?
--- John Machin [EMAIL PROTECTED] wrote:
On Tue, 19 Apr 2005 19:13:13 -0700 (PDT), Anthony
Liu
[EMAIL PROTECTED] wrote:
I think I got confused by the python import
facility.
Say, in code1.py I have
O, sorry, I did have
main()
at the very end of code1.py.
Sorry for this confusion.
--- John Machin [EMAIL PROTECTED] wrote:
On Tue, 19 Apr 2005 20:17:06 -0700 (PDT), Anthony
Liu
[EMAIL PROTECTED] wrote:
The choice is (b):
(b) you do have def main() as per my example, but
you have
Normally when we do
line = in_file_obj.readline()
we read from the first line of a file.
I am wondering if it is possible to start reading from
the last line of file, and then the last but one up to
the first line.
__
Do You Yahoo!?
Tired of
I have a dictionary which contains some words and
their frequency in a short novel.
It looks like this:
mydict = {'the':358, 'they':29, 'went':7, 'said':65}
Is there an easy to sort this dictionary and get a
list like the following (in decreasing order)?
the 358
said 65
they 29
went 7
--- Scott David Daniels [EMAIL PROTECTED] wrote:
Anthony Liu wrote:
mydict = {'the':358, 'they':29, 'went':7,
'said':65}
Is there an easy to sort this dictionary and get a
list like the following (in decreasing order)?
Yes.
def sortkey((word, frequency)):
return
Oh, yes, that's a cool function! I did that before but
have forgotten.
Thanks a lot!
--- Tony Meyer [EMAIL PROTECTED] wrote:
Suppose I have a list
myList = [this, is, a, sample, list]
If I don't want to iterate through it and
concatenate
the list elements, how do I easily
I cannot figure out how to specify a list of a
particular size.
For example, I want to construct a list of size 10,
how do I do this?
__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
PROTECTED] wrote:
Anthony Liu wrote:
I cannot figure out how to specify a list of a
particular size.
For example, I want to construct a list of size
10,
how do I do this?
A list does not have a fixed size (as you probably
know)
But you can initialize it with 10 somethings
I defined two functions, f1 and f2.
f1 modifies the value of a variable called apple.
I want to pass the modified value of apple to f2.
How can I do this? I got stuck.
__
Do you Yahoo!?
Yahoo! Mail - You care about security. So do
I want to use the set function like
mylist = ['a', 'b', 'b', 'd', 'e', 'a']
myset = set (mylist)
But I don't know what to import, I tried sys, sets,
they don't work.
What's the easy way to find out the module that
contains a particular function?
Thanks a lot, mine is Python 2.3, and
from sets import Set as set
works great!
--- Steven Bethard [EMAIL PROTECTED] wrote:
Anthony Liu wrote:
I want to use the set function like
mylist = ['a', 'b', 'b', 'd', 'e', 'a']
myset = set (mylist)
But I don't know what
33 matches
Mail list logo