neurophysik / jitcxde_common Goto Github PK
View Code? Open in Web Editor NEWCommon code for JiTC*DE
License: Other
Common code for JiTC*DE
License: Other
Hello, it's me again.
I found a bug in the conditional
routine (from jitcxde_common
). The description says the function returns value_if
if observable
is higher than threshold
. However, the returned value is
return value_if+(1+tanh((observable-threshold)/width))/2*(value_else-value_if)
As you see, if observable
is higher than threshold
, then tanh > 0 and the returned value is actually value_else
. The solution would be either to change the description, or change the last part of the returned value to (value_if-value_else)
.
Thanks!
Hey again :)
Not sure whether this should come here or to specific jitc*de I am using, but I feel it is a general question / problem.
So, I would need to make a table look-up as part of my dynamics. The thing is I am using a model (mean-field approximation of spiking neuron model) which uses pre-computed quantities in order to avoid solving Fokker-Planck equation each time step. So this table "converts" mean and standard deviation of membrane potential into firing rate. You can imagine it as
x_idx = int(<some function of mean potential>)
y_idx = int(<some function of std potential>)
firing_rate = table[x_idx, y_idx]
The problem is, of course, that the indices x_idx
and y_idx
are symbolic. Just to make a point x_idx
is
floor(14.0*(-0.5 + sqrt(2.25 + 472.392*current_y(9)/(2.0 + 20.0*(1.0 + del_fr_exc_exc)) + 2178.0*current_y(10)/(5.0 + 20.0*(1.0 + del_fr_exc_inh)))))
So what I tried:
symengine.Lambdify
the code is roughly as this:
def compute_from_cascade(..., x_idx, y_idx, dx_idx, dy_idx)
table_se = sympy.MatrixSymbol("table_se", *table.shape)
expr = (
table_se[y_idx, x_idx] * (1 - dx_idx) * (1 - dy_idx)
+ table_se[y_idx, x_idx + 1] * dx_idx * (1 - dy_idx)
+ table_se[y_idx + 1, x_idx] * (1 - dx_idx) * dy_idx
+ table_se[y_idx + 1, x_idx + 1] * dx_idx * dy_idx
)
func = se.Lambdify(table_se, expr)
return func(table)
so I need to define Matrix as a symbol and lambdify it in order to get correct indices for a table lookup. However, this is not working as
symengine.lib.symengine_wrapper.SympifyError: sympy2symengine: Cannot convert 'table_se[0, 0]' (of type <class 'sympy.matrices.expressions.matexpr.MatrixElement'>) to a symengine type.
Then I found out that MatrxSymbol
is not implemented in symengine
and nobody knows if and when they'd implement it (I've spent an afternoon searching their github issues)
y
and t
so the other option was to use "slow" sympy
(still faster I guess than pure python) and instead of
from jitcdde import t as time_vector
from jitcdde import y as state_vector_dde
I did
from jitcdde.sympy_symbols import t as time_vector
from jitcdde.sympy_symbols import y as state_vector_dde
unfortunately, this is not working as this time I am getting
TypeError: cannot determine truth value of Relational
unrelated to the table lookup and this is an earlier error, which means that sympy
is not really fully compatible with symenigne
since symengine
has no problems in determining the truth value of Relational
...
However, the problem is that in order to work this with sympy
I would need to rewrite almost all integration logic which then would become unusable with symengine
... Since this is the only model I am having problem implementing in jitc*de
I really do not want to rewrite the core logic to be compatible with sympy
, I am more than happy with symengine
.
I guess you're not an expert on symengine
but the main question is whether you have some idea how you would do symbolic table lookup, given that symengine
does not implement 2D symbolic arrays? Should I somehow approximate the table with a function?
Thanks a lot!
N.
Dear neurophysik,
Hello neurophysik, my name is JunSeokCha and I am a student. I found that your package is on pypi but not on conda-forge. May I submit your package to conda-forge? Would you allow me to add jitcxde, jitcode, jitcdde, jitcsde to conda-forge?
If you would like me to do so, then who would you like to be the maintainer of the conda-forge feedstock for your package?
The job of the maintainer of the feedstock is to:
Keep the feedstock updated by merging eventual maintenance PRs from conda-forge’s bots.
Keep the feedstock on par with new releases of the source package by:
Bumping the version number and checksum.
Making sure that the feedstock’s requirements stay accurate.
Make sure the test requirements match those of the updated package.
Answer eventual questions about the package on the feedstock issue tracker.
If you would like to be the maintainer of the conda-forge feedstock, then I will submit your name as the maintainer of feedstock in the conda-forge recipe. If you would not like to be the maintainer of the conda-forge feedstock, then I will submit my name on the conda-forge recipe as maintainer of feedstock.
Sincerely,
JunSeokCha
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.