Working with vectors usually requires a high dimensional space, which requires more neurons. Creating these is computationally expensive and may require more (ram) memory than your computer has. Here are some ways to get around that
import nef
import hrr
vocab=hrr.Vocabulary(128)
vocab.parse('cat,dog,mouse')
net=nef.Network('Test Network',quick=True)
# quick=true, if you have created these neurons in the past just re-use
net.add_to(world)
input1=net.make_input('input1',values=vocab.parse('cat').v)
A=net.make_array('A',neurons=30,dimensions=1,length=128)
B=net.make_array('B',neurons=500,dimensions=8,length=16)
# use an array
net.connect(input1,A)
net.connect(A,B,weight=0.3)
net.connect(B,B)
Using an array allows you to create a group of smaller nets that act as one larger net. A computer with less memory can cope with this. In the example, A is composed of 128 groups of 30 neurons that encode 1 dimension each, B is composed of 16 groups of 500 neurons that encode 8 dimensions each.
The relationship between the number of neurons and the number of dimensions is a judgement call, but more neurons will result in a cleaner, less noisy representation.
However, doing it this way creats a more localist representation of the dimensions (e.g., A represents each dimension seperately). This will reduce the amound of normalization that occurs
import nef
import hrr
vocab=hrr.Vocabulary(128)
vocab.parse('cat,dog,mouse')
net=nef.Network('Test Network',quick=True)
# quick=true, if you have created these neurons in the past just re-use
net.add_to(world)
input1=net.make_input('input1',values=vocab.parse('cat').v)
A=net.make_array('A',neurons=30,dimensions=1,length=128)
B=net.make_array('B',neurons=500,dimensions=8,length=16)
# use an array
net.connect(input1,A)
net.connect(A,B,weight=0.3)
net.connect(B,B)
Using an array allows you to create a group of smaller nets that act as one larger net. A computer with less memory can cope with this. In the example, A is composed of 128 groups of 30 neurons that encode 1 dimension each, B is composed of 16 groups of 500 neurons that encode 8 dimensions each.
The relationship between the number of neurons and the number of dimensions is a judgement call, but more neurons will result in a cleaner, less noisy representation.
However, doing it this way creats a more localist representation of the dimensions (e.g., A represents each dimension seperately). This will reduce the amound of normalization that occurs
No comments:
Post a Comment