Re: Covariance matrix syntax

2020-10-24 Thread Meghna Karkera
Dear Sir

Now I figured out why there was a difference when I manually computed
covariance and when I use the np. cov syntax in python.

The formula I used was ((yi-ymean)(yj-ymean))/n...unbiasdness.


The formula np.cov uses is ((yi-ymean)(yj-ymean)) /n-1.

Thanks

Sincerely
Meghna Raviraj Karkera

On Mon, Oct 19, 2020, 21:30 Markos  wrote:

> Hi Meghna,
>
> I organized some tutorials about Machine Learning for Chemistry with
> Python.
>
> Where you can find some info about the use of Covariance Matrix that may
> help you.
>
> The originals are in Portugueese, but you can read using Google Translator:
>
> https://tinyurl.com/yybazx9n
>
> https://tinyurl.com/y29mule6
>
> https://tinyurl.com/yxtg4tce
>
> Best Regards,
> Markos
>
> Em 19-10-2020 02:23, Meghna Karkera escreveu:
> > Dear Sir
> >
> > I am unable to find the *formula for covariance* used in np.cov syntax in
> > PYTHON given in link
> > https://numpy.org/doc/stable/reference/generated/numpy.cov.html.  Could
> you
> > please help me out.
> >
> > Thanks
> > Meghna
> >
> > On Tue, Oct 13, 2020 at 11:46 AM Christian Gollwitzer 
> > wrote:
> >
> >> Am 13.10.20 um 06:52 schrieb Meghna Karkera:
> >>> Could you let me know what is the back end calculation of this
> covariance
> >>> matrix syntax np.cov
> >>>
> >> You can look it up yourself: Go to the docs
> >> https://numpy.org/doc/stable/reference/generated/numpy.cov.html
> >>
> >> At the right hand side, just right of the function signature, there is a
> >> link [source]. Click there and it takes you to the implementation.
> >>
> >> Apparently it is done in straightforward Python.
> >>
> >>  Christian
> >>
> >> PS: Snipped a lot of unrelated citation at the bottom
> >>
> >>> On Tue, Oct 13, 2020, 10:14 Bruno P. Kinoshita <
> >> brunodepau...@yahoo.com.br>
> >>> wrote:
> >>> [...]
>  I think the np.cov is from the numpy module (imported/aliased as np?).
> >> --
> >> https://mail.python.org/mailman/listinfo/python-list
> >>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Covariance matrix syntax

2020-10-24 Thread Meghna Karkera
Is there any syntax for covariance which uses the unbiased formula
(yi-ymean)*(yj-ymean) /n...Monte Carlo method

On Sat, Oct 24, 2020, 21:11 Meghna Karkera  wrote:

> Dear Sir
>
> Now I figured out why there was a difference when I manually computed
> covariance and when I use the np. cov syntax in python.
>
> The formula I used was ((yi-ymean)(yj-ymean))/n...unbiasdness.
>
>
> The formula np.cov uses is ((yi-ymean)(yj-ymean)) /n-1.
>
> Thanks
>
> Sincerely
> Meghna Raviraj Karkera
>
> On Mon, Oct 19, 2020, 21:30 Markos  wrote:
>
>> Hi Meghna,
>>
>> I organized some tutorials about Machine Learning for Chemistry with
>> Python.
>>
>> Where you can find some info about the use of Covariance Matrix that may
>> help you.
>>
>> The originals are in Portugueese, but you can read using Google
>> Translator:
>>
>> https://tinyurl.com/yybazx9n
>>
>> https://tinyurl.com/y29mule6
>>
>> https://tinyurl.com/yxtg4tce
>>
>> Best Regards,
>> Markos
>>
>> Em 19-10-2020 02:23, Meghna Karkera escreveu:
>> > Dear Sir
>> >
>> > I am unable to find the *formula for covariance* used in np.cov syntax
>> in
>> > PYTHON given in link
>> > https://numpy.org/doc/stable/reference/generated/numpy.cov.html.
>> Could you
>> > please help me out.
>> >
>> > Thanks
>> > Meghna
>> >
>> > On Tue, Oct 13, 2020 at 11:46 AM Christian Gollwitzer 
>> > wrote:
>> >
>> >> Am 13.10.20 um 06:52 schrieb Meghna Karkera:
>> >>> Could you let me know what is the back end calculation of this
>> covariance
>> >>> matrix syntax np.cov
>> >>>
>> >> You can look it up yourself: Go to the docs
>> >> https://numpy.org/doc/stable/reference/generated/numpy.cov.html
>> >>
>> >> At the right hand side, just right of the function signature, there is
>> a
>> >> link [source]. Click there and it takes you to the implementation.
>> >>
>> >> Apparently it is done in straightforward Python.
>> >>
>> >>  Christian
>> >>
>> >> PS: Snipped a lot of unrelated citation at the bottom
>> >>
>> >>> On Tue, Oct 13, 2020, 10:14 Bruno P. Kinoshita <
>> >> brunodepau...@yahoo.com.br>
>> >>> wrote:
>> >>> [...]
>>  I think the np.cov is from the numpy module (imported/aliased as
>> np?).
>> >> --
>> >> https://mail.python.org/mailman/listinfo/python-list
>> >>
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Covariance matrix syntax

2020-10-24 Thread Marco Sulla
If you read the documentation, there's a `bias` bool parameter.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Covariance matrix syntax

2020-10-24 Thread Greg Ewing

On 25/10/20 4:49 am, Meghna Karkera wrote:

Is there any syntax for covariance which uses the unbiased formula
(yi-ymean)*(yj-ymean) /n...Monte Carlo method


I think you have "biased" and "unbiased" backwards. The formula
with n-1 is used when you want to calculate an *unbiased* estimate
for a population given a sample of that population.

The formula with n is used when your data consists of the entire
population.

Which situation do you have?

(I think the "bias" parameter to numpy.cov is badly named, btw.
If you're using it appropriately, setting biased=True does *not*
make your result biased -- quite the contrary!)

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Is there a log file that tracks every statement that is being executed when a program is running?

2020-10-24 Thread Steve
This would seriously help troubleshooting for me.  I updated a data file and
now my main program is choking on it.  When the program encounters an error,
it dumps a bit of information to the screen for a few steps before the error
but that is not enough.




Footnote:
English sprakers on a roller coaster: "W"
Spanish speakers on a rollercoaster:  " Nosostros"

-Original Message-
From: Python-list  On
Behalf Of shrimp_banana
Sent: Saturday, October 17, 2020 9:47 PM
To: python-list@python.org
Subject: Re: File Name issue

On 10/17/20 4:12 PM, Steve wrote:
 > The line:
 > with open("HOURLYLOG.txt", 'r') as infile:
 > works but, when I rename the file, the line:
 > with open("HOURLY-LOG.txt", 'r') as infile:
 > does not.  The complaint is: Cannot Assign to operator  >  > However, I
have:
 > BPM_O2s=open("BPM-O2-Readings.txt","a")
 > And it works.
 >
 > At first, I thought the issue was due to having the - in the filename.
 >
 > Is there a fix or explanation for this?
 > Steve

I am unsure if this will help but you could try putting an r in front of the
quotes to make it take raw data only.
ie.

with open(r"HOURLY-LOG.txt", 'r') as infile
--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a log file that tracks every statement that is being executed when a program is running?

2020-10-24 Thread MRAB

On 2020-10-25 00:21, Steve wrote:

This would seriously help troubleshooting for me.  I updated a data file and
now my main program is choking on it.  When the program encounters an error,
it dumps a bit of information to the screen for a few steps before the error
but that is not enough.

You could install Visual Studio Code and the extension for Python. That 
will let you single-step through the code.

--
https://mail.python.org/mailman/listinfo/python-list