On Wednesday 06 January 2016 07:25, Robert wrote:
> Why is there difference between cmd line and .py file?
Almost certainly because you are not running exactly the same code each
time.
> I run below code, which is downloaded from link:
Your code fails on the first line with
Nam
On Wednesday 06 January 2016 07:37, John Gordon wrote:
> The built-in function sum() returns a single value, not a list, so this
> is a reasonable error.
Not quite. It depends on what arguments you give it.
py> a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
py> sum(a, [])
[1, 2, 3, 4, 5, 6, 7, 8, 9]
Bu
On Wednesday 06 January 2016 10:25, Thomas 'PointedEars' Lahn wrote:
> Robert wrote:
>
>> I just wonder that the cmd line function sum may be different from the
>> .py file used. One is numpy package, the other is a general one. Then,
>> how can I further make it clear for this guess?
>
> Among
Robert wrote:
> I just wonder that the cmd line function sum may be different from the
> .py file used. One is numpy package, the other is a general one. Then,
> how can I further make it clear for this guess?
Among other things:
print(sum.__doc__)
--
PointedEars
Twitter: @PointedEars2
Please
Joel Goldstick wrote:
> On Tue, Jan 5, 2016 at 3:45 PM, Robert wrote:
>> import numpy as np
>>
>> In [154]: np.sum(expectation_A)[0]
>> […]
>> IndexError: invalid index to scalar variable.
>
> I've not used numpy, but you should print expectation_A to see what's in
> it. It may be empty, causin
On Tuesday, January 5, 2016 at 3:58:44 PM UTC-5, Joel Goldstick wrote:
> On Tue, Jan 5, 2016 at 3:45 PM, Robert wrote:
>
> > On Tuesday, January 5, 2016 at 3:37:53 PM UTC-5, John Gordon wrote:
> > > In Robert <
> > r...@gmail.com> writes:
> > >
> > > >
> > > > # represent the experi
On Tue, Jan 5, 2016 at 3:45 PM, Robert wrote:
> On Tuesday, January 5, 2016 at 3:37:53 PM UTC-5, John Gordon wrote:
> > In Robert <
> r...@gmail.com> writes:
> >
> > >
> > > # represent the experiments
> > > head_counts = np.array([5,9,8,4,7])
> >
> > The code doesn't define 'np', s
On Tuesday, January 5, 2016 at 3:37:53 PM UTC-5, John Gordon wrote:
> In Robert
> writes:
>
> >
> > # represent the experiments
> > head_counts = np.array([5,9,8,4,7])
>
> The code doesn't define 'np', so this line should produce an error.
>
> The code you linked contains this im
On Tuesday, January 5, 2016 at 3:26:15 PM UTC-5, Robert wrote:
> Hi,
>
> I run below code, which is downloaded from link:
>
> http://stackoverflow.com/questions/15513792/expectation-maximization-coin-toss-examples?rq=1
>
>
>
>
> # represent the experiments
> head_counts = np.array
In Robert
writes:
>
> # represent the experiments
> head_counts = np.array([5,9,8,4,7])
The code doesn't define 'np', so this line should produce an error.
The code you linked contains this import:
import numpy as np
However you didn't show it here, so I wonder if you poste
Hi,
I run below code, which is downloaded from link:
http://stackoverflow.com/questions/15513792/expectation-maximization-coin-toss-examples?rq=1
# represent the experiments
head_counts = np.array([5,9,8,4,7])
tail_counts = 10-head_counts
experiments = zip(head_counts,tail_counts)
11 matches
Mail list logo