google / google/carfac

Output scaling question

Open
#30 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
145
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Hello, thank you for providing this model open source!

I have a question about the output range of the NAP / IHC values. I was expecting the output values to be in the [0, 1] range as mentioned in section 18.3 of Human and Machine Hearing. I understand the values to represent the "probability of firing" for a neuron.

Testing out the numpy and JAX implementations with the default design parameters and some sample input (noise and sines at varying volumes), I am getting different results though. The output seems to have a floor at a specific value of -0.81157 (consistent across different types of input), and have peaks anywhere between 2 and 10 depending on the input signal.

Here is some example code:

```python
sr = 22050
f0 = 300
x = jnp.sin(2 * jnp.pi * f0 * jnp.arange(sr // 10) / sr) * 0.1

params_jax = carfac.CarfacDesignParameters(fs=sr)
hypers_jax, weights_jax, state_jax = carfac.design_and_init_carfac(
params_jax
)

naps, naps_fibers, state, bm, seg_ohc, seg_agc = carfac.run_segment(x, hypers_jax, weights_jax, state_jax)

fig, ax = plt.subplots(3, 1, figsize=(8, 6), sharex=True)
ax[0].plot(x)
ax[0].set_title('input')

ax[1].imshow(naps.squeeze().T, aspect='auto')
ax[1].set_title('NAP')

ax[2].plot(naps[:, 50])
ax[2].set_title('NAP channel 50')
ax[2].axhline(-0.81157, color='r')
ax[2].grid()
plt.show()
```

And the output:

Image

Could you help me understand how to interpret these values? Is there some sensible design parameter setting or some post-scaling that I can apply to constrain the output to [0, 1]?

Thanks again and sorry if I'm missing something obvious, I'm very new to working with these models!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.