dfm / dfm/emcee

EnsembleSampler error

Open
#328 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
440
PR merge metrics
No merged PRs in 30d

Description

  • emcee version: 2.2.1
  • platform: Windows 7
  • installation method (pip/conda/source/other?):pip

I'm having this message:
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/Adriana/Anaconda3/Lib/site-packages/radvel/borrar ya.py', wdir='C:/Users/Adriana/Anaconda3/Lib/site-packages/radvel')

File "C:\Users\Adriana\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "C:\Users\Adriana\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Adriana/Anaconda3/Lib/site-packages/radvel/borrar ya.py", line 18, in
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=[ivar])

File "C:\Users\Adriana\Anaconda3\lib\site-packages\emcee\ensemble.py", line 91, in init
super(EnsembleSampler, self).init(dim, lnpostfn, args=args,

TypeError: super(type, obj): obj must be an instance or subtype of type

This happens when I run:

import numpy as np
import emcee

def lnprob(x, ivar):
return -0.5 * np.sum(ivar * x ** 2)

ndim, nwalkers = 10, 100
ivar = 1. / np.random.rand(ndim)
p0 = [np.random.rand(ndim) for i in range(nwalkers)]

sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=[ivar])
sampler.run_mcmc(p0, 1000)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction in the issue and inspect emcee/ensemble.py around line 91, where EnsembleSampler initialization fails. Reproduce the TypeError using emcee 2.2.1 on the reported environment, then determine the smallest supported fix and verify that the sample sampler setup runs successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.