Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use solver for translate/transform_to #57

Closed
jgosmann opened this issue Jun 26, 2017 · 0 comments
Closed

Allow to use solver for translate/transform_to #57

jgosmann opened this issue Jun 26, 2017 · 0 comments
Milestone

Comments

@jgosmann
Copy link
Collaborator

Allow to provide a solver for the translation between vocabularies. That can give better results than the simple outer product matrix.

v1 = spa.Vocabulary(d)
v2 = spa.Vocabulary(d)

s = 'A; B; C; D; E; F; G; H; I; J'
v1.populate(s)
v2.populate(s)

U1 = np.asarray([p.v for p in v1.parse_n(*s.split(';'))])
U2 = np.asarray([p.v for p in v2.parse_n(*s.split(';'))])

solver = nengo.solvers.Lstsq()
Ta = solver(U1, U2)[0].T
Tb = v1.transform_to(v2)

Va = Ta.dot(U1.T).T
Vb = Tb.dot(U1.T).T

Sa = spa.similarity(Va, v2)
Sb = spa.similarity(Vb, v2)

plt.title("Lstsq (%s)" % nengo.utils.numpy.rmse(Sa, np.eye(len(U1))))
plt.imshow(Sa, vmin=0, vmax=1)
plt.colorbar()
plt.show()

plt.title("transform_to (%s)" % nengo.utils.numpy.rmse(Sb, np.eye(len(U1))))
plt.imshow(Sb, vmin=0, vmax=1)
plt.colorbar()
plt.show()
jgosmann added a commit that referenced this issue Jun 30, 2017
This will make it easier to support a solver argument as proposed
in #57.
jgosmann added a commit that referenced this issue Jun 30, 2017
That can give better matrices to transform between vocabularies.

Addresses #57.
jgosmann added a commit that referenced this issue Jun 30, 2017
jgosmann added a commit that referenced this issue Aug 20, 2017
This will make it easier to support a solver argument as proposed
in #57.
jgosmann added a commit that referenced this issue Aug 20, 2017
That can give better matrices to transform between vocabularies.

Addresses #57.
jgosmann added a commit that referenced this issue Aug 20, 2017
jgosmann added a commit that referenced this issue Aug 20, 2017
This will make it easier to support a solver argument as proposed
in #57.
jgosmann added a commit that referenced this issue Aug 20, 2017
That can give better matrices to transform between vocabularies.

Addresses #57.
jgosmann added a commit that referenced this issue Aug 20, 2017
@jgosmann jgosmann added this to the 0.3 release milestone Aug 20, 2017
jgosmann added a commit that referenced this issue Aug 20, 2017
This will make it easier to support a solver argument as proposed
in #57.
jgosmann added a commit that referenced this issue Aug 20, 2017
That can give better matrices to transform between vocabularies.

Addresses #57.
jgosmann added a commit that referenced this issue Aug 20, 2017
@jgosmann jgosmann closed this as completed Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant