[nengo-user] Adjusting topological connections
Omar Zahra
omar.zahra at ejust.edu.eg
Mon Aug 8 14:14:01 EDT 2016
Also to be sure that I understod completely what you meant , for example if
I wnt output from a.neurons to be squared and input to b.neurons
I would write:
def func(t, x):
return x*x
mynode = nengo.Node(func, size_in=50, size_out=50)
nengo.Connection(a.neurons, mynode)
nengo.Connection(mynode, b.neurons)
Is that correct ??
On Mon, Aug 8, 2016 at 8:05 PM, Omar Zahra <omar.zahra at ejust.edu.eg> wrote:
> Thank you Terry. I am really grateful.
> But , unfortunately I cannot even find function as one of the parameters
> of the node, do you have some examples I can follow to get better
> experience with NENGO?
>
>
> On Mon, Aug 8, 2016 at 8:02 PM, Terry Stewart <terry.stewart at gmail.com>
> wrote:
>
>> You should be able to do that with the node, since the return value
>> from that node is the input to b. x[0] is the output of a.neurons[0],
>> and so if your return value's [0] element is just based on x[0], then
>> the input to b.neurons[0] will be based only on the output from
>> a.neurons[0].
>>
>> Terry
>>
>> On Mon, Aug 8, 2016 at 1:56 PM, Omar Zahra <omar.zahra at ejust.edu.eg>
>> wrote:
>> > yes , that's exactly what I wanted to do. Using node would solve my
>> problem.
>> > The only remaining point is now the input to the node is some firing
>> rate
>> > (x) , I want for example b.neurons[0] to have an output depending on
>> input
>> > from a.neurons[0] ONLY.
>> >
>> > On Mon, Aug 8, 2016 at 7:45 PM, Terry Stewart <terry.stewart at gmail.com>
>> > wrote:
>> >>
>> >> Hmm, I'm still not quite sure what you're trying to do here. What do
>> >> you mean by a "function for the rate of spikes"? Do you mean neuron
>> >> model itself (i.e. the thing that takes input current and generates
>> >> spikes)? If so, that's already part of the Ensemble and is specified
>> >> by the neuron_type parameter, and you can choose from LIF, LIFRate,
>> >> Izhikevich, Sigmoid, or write your own. Or do you want to do
>> >> something to the spikes after they've been generated by the neurons
>> >> and before they're fed to the next group of neurons? What sort of
>> >> thing are you envisioning here?
>> >>
>> >> That said, in general, you can implement anything you want in Nengo by
>> >> creating a Node:
>> >>
>> >> -------------------
>> >> import nengo
>> >>
>> >> model = nengo.Network()
>> >> with model:
>> >> a = nengo.Ensemble(n_neurons=50, dimensions=1)
>> >> b = nengo.Ensemble(n_neurons=50, dimensions=1)
>> >>
>> >> def func(t, x):
>> >> # do whatever you want in here, where x is the input spikes and
>> >> # you return the output activity
>> >> return x
>> >> mynode = nengo.Node(func, size_in=50, size_out=50)
>> >>
>> >> nengo.Connection(a.neurons, mynode)
>> >> nengo.Connection(mynode, b.neurons)
>> >> ----------------------
>> >>
>> >>
>> >> I'm still not sure whether that's what you're looking for, however....
>> >>
>> >>
>> >> Terry
>> >>
>> >> On Mon, Aug 8, 2016 at 1:34 PM, Omar Zahra <omar.zahra at ejust.edu.eg>
>> >> wrote:
>> >> > This part I couldn't actually understand from the documentation
>> well. I
>> >> > thought that It wasn't about getting "the optimal connection
>> weights" ,
>> >> > I
>> >> > just wanted to apply some function for the rate of spikes, and the
>> >> > output
>> >> > from the function would be input tp the postsynaptic.
>> >> > Sorry for that misunderstanding , how then would I apply some
>> function
>> >> > to
>> >> > the rate of spike ?
>> >> > Thanks for your patience
>> >> >
>> >> > On Mon, Aug 8, 2016 at 6:04 PM, Terry Stewart <
>> terry.stewart at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> I think the problem is that you're trying to specify a function as
>> >> >> well. What function are you trying to do?
>> >> >>
>> >> >> The problem is that you're specifying the connection weights in two
>> >> >> different ways. When you save function=something, Nengo uses that
>> >> >> function to find the optimal connection weights to approximate that
>> >> >> function. So you can't also manually specify the connection
>> weights,
>> >> >> since that's exactly what you've told nengo to solve for on its own!
>> >> >>
>> >> >> Terry
>> >> >>
>> >> >> On Mon, Aug 8, 2016 at 12:00 PM, Omar Zahra <
>> omar.zahra at ejust.edu.eg>
>> >> >> wrote:
>> >> >> > Hello Terry,
>> >> >> >
>> >> >> > Thanks for your reply. I already used this to make a connection.
>> >> >> > My problem is that I cannot " nengo.Connection(a.neurons,
>> b.neurons,
>> >> >> > transform=matrix, function = func)" because it must be applied to
>> an
>> >> >> > Ensemble.
>> >> >> > I hope you have some solution for this problem.
>> >> >> >
>> >> >> > On Mon, Aug 8, 2016 at 5:47 PM, Terry Stewart
>> >> >> > <terry.stewart at gmail.com>
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> Hello Omar,
>> >> >> >>
>> >> >> >> If you want to use Nengo to do manual neuron-to-neuron connection
>> >> >> >> (i.e. the sort of thing that would happen in a standard neural
>> >> >> >> simulator), then you need to connection to the ens.neurons
>> object.
>> >> >> >> For example, here's a quick way to do random connections between
>> two
>> >> >> >> groups of neurons:
>> >> >> >>
>> >> >> >> --------------
>> >> >> >> import nengo
>> >> >> >> import numpy as np
>> >> >> >>
>> >> >> >> model = nengo.Network()
>> >> >> >> with model:
>> >> >> >> a = nengo.Ensemble(n_neurons=50, dimensions=1)
>> >> >> >> b = nengo.Ensemble(n_neurons=50, dimensions=1)
>> >> >> >>
>> >> >> >> matrix = np.random.normal(size=(50, 50))
>> >> >> >> nengo.Connection(a.neurons, b.neurons, transform=matrix)
>> >> >> >> -------------------------
>> >> >> >>
>> >> >> >> Let us know if that helps for your situations!
>> >> >> >>
>> >> >> >> Also, for future questions, we've just started up an online
>> forum at
>> >> >> >> https://forum.nengo.ai/
>> >> >> >>
>> >> >> >> Terry
>> >> >> >>
>> >> >> >> On Mon, Aug 8, 2016 at 9:13 AM, Omar Zahra <
>> omar.zahra at ejust.edu.eg>
>> >> >> >> wrote:
>> >> >> >> > Hello,
>> >> >> >> >
>> >> >> >> > I am new to NENGO and also just started using python to deal
>> with
>> >> >> >> > NENGO.
>> >> >> >> > I
>> >> >> >> > would like to build part of the brain by connecting some
>> layers.
>> >> >> >> > These
>> >> >> >> > connections are supposed to be topological. I would like also
>> to
>> >> >> >> > apply
>> >> >> >> > some
>> >> >> >> > function across these connections. When I try to use
>> connection to
>> >> >> >> > the
>> >> >> >> > whole
>> >> >> >> > ensemble, I cannot define the connections perfectly as done in
>> >> >> >> > case
>> >> >> >> > of
>> >> >> >> > making connections neuron by neuron -using Ensemble.neurons[]
>> -. I
>> >> >> >> > tried
>> >> >> >> > even increasing the dimensions of the ensemble and setting the
>> >> >> >> > encoders
>> >> >> >> > such
>> >> >> >> > as to give seperate action for each neuron, still some
>> unintended
>> >> >> >> > response
>> >> >> >> > appears.
>> >> >> >> > Reply ASAP please. Thanks in advance
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Best Regards
>> >> >> >> > Omar Ibn ElKhatab AbdAllah Zahra
>> >> >> >> >
>> >> >> >> > _______________________________________________
>> >> >> >> > nengo-user mailing list
>> >> >> >> > nengo-user at ctnsrv.uwaterloo.ca
>> >> >> >> > http://ctnsrv.uwaterloo.ca/mailman/listinfo/nengo-user
>> >> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Best Regards
>> >> >> > Omar Ibn ElKhatab AbdAllah Zahra
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Best Regards
>> >> > Omar Ibn ElKhatab AbdAllah Zahra
>> >
>> >
>> >
>> >
>> > --
>> > Best Regards
>> > Omar Ibn ElKhatab AbdAllah Zahra
>>
>
>
>
> --
> Best Regards
> Omar Ibn ElKhatab AbdAllah Zahra
>
--
Best Regards
Omar Ibn ElKhatab AbdAllah Zahra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://artsservices.uwaterloo.ca/pipermail/nengo-user/attachments/20160808/7ab66c3a/attachment-0002.html>
More information about the nengo-user
mailing list