-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to read command --ndim #13
Comments
Hi. Your line numbers for the output don't match the print statements in the current code, so presumably you have either made some local changes to the code, or don't have the most recent version. Can you please try with the same code as the most recent version? The code is also tested on Python 3.5.2, so if you can check on that version if using the updated code doesn't work, that would be helpful. |
Hi, Thanks for your prompt reply. For a check, I did a run again with the original MCEvidence.py file (git cloning the master branch for the code). This time I am using python version 2.7. One change that I made in the .py file is in line 1216. Because on running command, python MCEvidence.py ../../mcevidence/MCEvidence/plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE --ndim 6 I got, INFO:MCEvidence.py.params_info():1215 getting params info from COSMOMC file ../../mcevidence/MCEvidence/plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE.ranges I changed in line 1216, dtype=None to dtype=float. (was trying to resolve this error) After this change, the error is the same as I mentioned before, even with python2. INFO:MCEvidence.py.params_info():1215 getting params info from COSMOMC file ../../mcevidence/MCEvidence/plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE.ranges Using file: ../../mcevidence/MCEvidence/plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE Please see if any other information is required. Thanks! |
Can you try running the code with the option "-vb 2" and attaching the output and the .ranges file you are using? The code seems to replace the ndim argument with the number of parameter names in the cosmomc ranges file. |
Hi, after using the command: python MCEvidence.py -vb 2 plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE --ndim 6 I get, INFO:MCEvidence.py.params_info():1215 getting params info from COSMOMC file plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE.ranges Using file: plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE |
There seems to be a problem processing the .ranges file - this is its output after processing the file: Can you attach the .ranges file in a reply on this issue? |
Hi, Please find attached the .ranges file. I have converted it into a .txt format to attach here. |
The issue seems to be the N's in the .range files - the code for reading them in fails. Since unbounded ranges lead to unbounded volumes and hence a zero volume prior, I'm not sure that this tool is appropriate for your task unless you specify an upper bound in the .ranges file for these parameters? (@yabebalFantaye : Should we add some kind of warning or error, or do you have some other feedback?) |
Hi, Thanks for giving time to this issue. I removed those parameters with unbounded ranges in the .ranges file and rerun the command, yet I got the same error as in the previous case. Also, I tried to run the code using python terminal, with two lines command as: from MCEvidence import MCEvidence in which case I get an output as, INFO:MCEvidence.py.setup():142 Loading chain from plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE But it seems here .ranges file is not called! Since I wanted to use this code for a setup where I have a few extra parameters(for a particular inflation model) to be introduced as cosmological parameters and calculate the evidence for such a model, I am not sure how this can be done using python terminal. The instructions to work with the MCEvidence.py file were somewhat clear through the 'help' option. |
Hi.
1. You shouldn't use "dtype=float", because the first column contains
strings, not floats. To address the deprecation warning, you can add the
keyword argument "encoding=None" to that call. Hopefully that helps.
2. Yes, the extraction from the .ranges file is part of the pre-processing
to provide suitable arguments when the MCEvidence object is instantiated -
the file is not processed within the object.
Steve
…On Mon, Jul 18, 2022 at 8:14 PM yashi0195 ***@***.***> wrote:
Hi,
Thanks for giving time to this issue.
I removed those parameters with unbounded ranges in the .ranges file and
rerun the command, yet I got the same error as in the previous case.
I doubt that it may be related to the change I made in line 1216 of the
code, where I changed dtype=None to dtype=float. But without this change,
the code was not working (giving another error, which I also mentioned in
my second comment on this issue). Please see if this can be related to the
present error.
Also, I tried to run the code using python terminal, with two lines
command as:
from MCEvidence import MCEvidence
MLEbase=
MCEvidence('plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE',ndim=6).evidence()
in which case I get an output as,
INFO:MCEvidence.py.setup():142 Loading chain from
plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE
INFO:MCEvidence.py.load_from_file():595 loading files:
plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_?.txt
INFO:MCEvidence.py.read_list_to_array():563 loading:
plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_3.txt
INFO:MCEvidence.py.read_list_to_array():563 loading:
plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_1.txt
INFO:MCEvidence.py.read_list_to_array():563 loading:
plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_2.txt
INFO:MCEvidence.py.read_list_to_array():563 loading:
plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_4.txt
INFO:MCEvidence.py.*init*():781 chain array dimensions: [37411] x 6 =
INFO:MCEvidence.py.get_covariance():859 Estimating covariance matrix using
all chains
INFO:MCEvidence.py.get_covariance():863 covariance matrix estimated using
nsample=37411
INFO:MCEvidence.py.get_samples():910 getting samples for partition s1:
nsamples=37411
INFO:MCEvidence.py.evidence():1163 ln(B)[k=1] = -627.5906231903703
INFO:MCEvidence.py.evidence():1163 ln(B)[k=2] = -627.4490723146458
INFO:MCEvidence.py.evidence():1163 ln(B)[k=3] = -627.3855217868755
INFO:MCEvidence.py.evidence():1163 ln(B)[k=4] = -627.3377810034593
But it seems here .ranges file is not called!
Since I wanted to use this code for a setup where I have a few extra
parameters(for a particular inflation model) to be introduced as
cosmological parameters and calculate the evidence for such a model, I am
not sure how this can be done using python terminal. The instructions to
work with the MCEvidence.py file were somewhat clear through the 'help'
option.
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4HWKEUCX72DYIGPU72W53VUWNHHANCNFSM53TDM5XQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi, Thanks a lot! The issue is now resolved after using the "encoding=None" command and keeping dtype=None in line 1216 in MCEvidence.py. One thing I would like to add is that even in this case, if the '.ranges' file has unbound ranges (those N's that you pointed out in previous comments), the code does not run. I have to remove those lines manually from the .ranges file, after which only I got the output. So my suggestion would be to display a warning message (or maybe include it in the instructions in README.md) to the user to ensure that the '.ranges' file does not have unbounded entities. It would be helpful. But, thanks a lot for your help and efforts :) Regards, |
Hi,
I am trying to run the code using the command:
python lcdm-dataset1-evidence.py plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE --ndim 6
where 'lcdm......py' is my input file. ( just a copy of MCEveidence with a different name for trying.)
Somehow the code is not able to read the number of parameters from the command --ndim or -np as the output is as follows,
INFO:lcdm-dataset1-evidence.py.params_info():1219 getting params info from COSMOMC file plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE.ranges
INFO:lcdm-dataset1-evidence.py.get_prior_volume():1325 getting prior volume using cosmomc *.ranges or montepython log.param outputs
INFO:lcdm-dataset1-evidence.py.get_prior_volume():1326 prior_volume=1.0
INFO:lcdm-dataset1-evidence.py.get_prior_volume():1327 Number of params to use: ndim=0
Using file: plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE
INFO:lcdm-dataset1-evidence.py.setup():146 Loading chain from plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE
INFO:lcdm-dataset1-evidence.py.read_list_to_array():567 loading: plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_3.txt
INFO:lcdm-dataset1-evidence.py.read_list_to_array():567 loading: plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_1.txt
INFO:lcdm-dataset1-evidence.py.read_list_to_array():567 loading: plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_2.txt
INFO:lcdm-dataset1-evidence.py.read_list_to_array():567 loading: plikHM_TT_lowl_lowE/base_plikHM_TT_lowl_lowE_4.txt
INFO:lcdm-dataset1-evidence.py.init():785 chain array dimensions: [37411] x 0 =
INFO:lcdm-dataset1-evidence.py.get_covariance():863 Estimating covariance matrix using all chains
INFO:lcdm-dataset1-evidence.py.get_covariance():867 covariance matrix estimated using nsample=37411
INFO:lcdm-dataset1-evidence.py.get_samples():914 getting samples for partition s1: nsamples=37411
Traceback (most recent call last):
File "lcdm-dataset1-evidence.py", line 1476, in
mce.evidence()
File "lcdm-dataset1-evidence.py", line 1104, in evidence
nbrs = NearestNeighbors(n_neighbors=kmax+1,metric='euclidean',leaf_size=20,
File "/home/yashi/anaconda3/lib/python3.8/site-packages/sklearn/neighbors/_base.py", line 1173, in fit
return self._fit(X)
File "/home/yashi/anaconda3/lib/python3.8/site-packages/sklearn/neighbors/_base.py", line 401, in _fit
X = self._validate_data(X, accept_sparse='csr')
File "/home/yashi/anaconda3/lib/python3.8/site-packages/sklearn/base.py", line 420, in _validate_data
X = check_array(X, **check_params)
File "/home/yashi/anaconda3/lib/python3.8/site-packages/sklearn/utils/validation.py", line 72, in inner_f
return f(**kwargs)
File "/home/yashi/anaconda3/lib/python3.8/site-packages/sklearn/utils/validation.py", line 658, in check_array
raise ValueError("Found array with %d feature(s) (shape=%s) while"
ValueError: Found array with 0 feature(s) (shape=(37411, 0)) while a minimum of 1 is required.
Please help me understand what is going wrong.
The text was updated successfully, but these errors were encountered: