Coder Social home page Coder Social logo

hrf_estimation's Introduction

Hi there ๐Ÿ‘‹. My name is Fabian and

  • ๐Ÿ”ญ Iโ€™m currently working on making machine learning more safe and efficient.
  • ๐ŸŽ“ You'll find all my publications in my Google Scholar.
  • ๐Ÿ“ I write a blog about optimization and machine learning: https://fa.bianp.net .
  • ๐Ÿ’ฌ Ask me about optimization, machine learning.
  • ๐Ÿ“ซ How to reach me: [email protected] .
  • ๐Ÿ˜„ Pronouns: he/him.

hrf_estimation's People

Contributors

fabianp avatar yarikoptic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hrf_estimation's Issues

error in running function rank_one

Hi Fabian,
Thanks for sharing the toolbox! I understand that the package is not actively maintained at the moment but thought I would give a try asking the question.
I was trying to work through the example that you provided for hrf_estimation. However I ran into this error message (pasted below) when trying to run rank_one_.py. I'm fairly new to python programming and have not yet been able to figure out why the error has occurred. I would much appreciate if you'd share any thoughts. Thanks!

Traceback (most recent call last):

File "", line 1, in
out = he.rank_one(design, a, n_basis, drifts=drifts)

File "/Users/zhour/anaconda3/lib/python3.6/site-packages/hrf_estimation/rank_one_.py", line 261, in rank_one
**kwargs)

File "/Users/zhour/anaconda3/lib/python3.6/site-packages/scipy/optimize/lbfgsb.py", line 199, in fmin_l_bfgs_b
**opts)

File "/Users/zhour/anaconda3/lib/python3.6/site-packages/scipy/optimize/lbfgsb.py", line 335, in _minimize_lbfgsb
f, g = func_and_grad(x)

File "/Users/zhour/anaconda3/lib/python3.6/site-packages/scipy/optimize/lbfgsb.py", line 285, in func_and_grad
f = fun(x, *args)

File "/Users/zhour/anaconda3/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 292, in function_wrapper
return function(*(wrapper_args + args))

File "/Users/zhour/anaconda3/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 63, in call
fg = self.fun(x, *args)

File "/Users/zhour/anaconda3/lib/python3.6/site-packages/hrf_estimation/rank_one_.py", line 65, in f_grad
res = Y.ravel() - X.dot(np.outer(u, v).ravel('F')).ravel() - drifts.dot(bias)

ValueError: operands could not be broadcast together with shapes (23520,) (20160,)

pip install results in newer version than master (0.6.0)?

Hi Fabian,

thanks a lot for sharing this. I can't wait to try this with my own data.

After a pip install hrf_estimation, what I have is:

In [4]: he.__version__
Out[4]: '0.6.0'

That confuses me. Apparently the pypi version is newer than current master? I noticed, because the examples don't run with the pip version, e.g. he.data.get_sample_data() already applies the filtering inside the function call.

Do you understand what's happening here?

Best,
Matthias

r1glms assertion error

Hi,

When I tried to use the 'r1glms' option in the iPython notebook example, I got the following error:

drifts = np.ones((voxels.shape[0], 1))
hrfs, betas = he.glm(conditions, onsets, 1., voxels, drifts=drifts, mode='r1glms', basis='3hrf', verbose=1)
.. creating design matrix ..
.. done creating design matrix ..
.. computing initialization ..
.. done initialization ..
Traceback (most recent call last):

  File "<ipython-input-6-16194dc738f8>", line 3, in <module>
    hrfs, betas = he.glm(conditions, onsets, 1., voxels, drifts=drifts, mode='r1glms', basis='3hrf', verbose=1)

  File "/home/rick/anaconda/lib/python2.7/site-packages/hrf_estimation/rank_one_.py", line 429, in glm
    for y_i, w_i in zip(Y_split, W_init_split))

  File "/home/rick/anaconda/lib/python2.7/site-packages/joblib/parallel.py", line 653, in __call__
    self.dispatch(function, args, kwargs)

  File "/home/rick/anaconda/lib/python2.7/site-packages/joblib/parallel.py", line 400, in dispatch
    job = ImmediateApply(func, args, kwargs)

  File "/home/rick/anaconda/lib/python2.7/site-packages/joblib/parallel.py", line 138, in __init__
    self.results = func(*args, **kwargs)

  File "/home/rick/anaconda/lib/python2.7/site-packages/hrf_estimation/rank_one_.py", line 216, in rank_one
    assert w_i.shape[0] == n_basis + 2 * size_v + drifts.shape[1]

AssertionError

I also tried the same thing on a different dataset but also got the same error.

function get_sample_data don't work

Hi,
Thank you for your share.
When I follow the examples in the ipython notebook with the newset software, I find that I can't work through it, the error occured as below:
image
I guess it's because I can't access the data, I try to access the url 'http://fa.bianp.net/projects/hrf_estimation/data' from my expoler and failed:
image

Another question is whether the toolbox can work on block designed data, I find that the parameter 'onsets' for hrf_estimation.glm() is an array of shape (n_trials) but not shape(n_scans).

NameError: global name 'canonical_full' is not defined

Hey,

With the latest version of hrf_estimation I get the following error when fitting a GLM:

[code]
.. creating design matrix ..
.. done creating design matrix ..

.. computing initialization ..

NameError Traceback (most recent call last)
in ()
1 # we call he.glm with our data and a TR of 1 second
2 # we also specify the basis function for the HRF estimation
----> 3 hrfs, betas = he.glm(conditions, onsets, 1., voxels, basis='dhrf', verbose=True)

/usr/local/lib/python2.7/dist-packages/hrf_estimation-0.5.1-py2.7.egg/hrf_estimation/rank_one_.pyc in glm(conditions, onsets, TR, Y, basis, mode, hrf_length, oversample, rtol, verbose, maxiter, callback, method, n_jobs, init, return_design_matrix, return_raw_U, cache)
370 else:
371 U_init, V_init = utils.glms_from_glm(
--> 372 X_design, Q, canonical_full, n_jobs, False, Y)
373
374 U_init = U_init.mean(1)

NameError: global name 'canonical_full' is not defined
[/code]

r1glms code question

Hi Fabian,
I was trying to understand the machinery of the r1glms estimation and in the code here
https://github.com/fabianp/hrf_estimation/blob/master/hrf_estimation/rank_one_.py#L417
if I understand correctly W_init is an initial estimation of the betas per regressor.
However in this line, the first row corresponding to the first regressor/the first event is omitted, is there a reason? Shouldn't it be the drift/intercept (last row) that should be removed?

Also I was wondering if it makes sense and would it work to use rank_one() with a block design instead of event-related, including event duration with boxcars convolved with a hrf or 3hrf?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.