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

Solver satisfying Dale's principle. #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solver satisfying Dale's principle. #70

wants to merge 1 commit into from

Conversation

Seanny123
Copy link
Contributor

@Seanny123 Seanny123 commented Mar 20, 2018

Based off the code described in this Nengo issue. Equivalent in effect to the Parisien transform, but has better performance.

Still to do:

  • The L2 regularisation is definitely being done wrong and should be fixed
  • According to @astoeckel, the nnls solver in SciPy has problems and cvxopt should be used instead, as shown in this forum post.
  • The Parisien transform should be included as well as a point of comparison.

class DalesL2(Dales):
"""Solves for weights subject to Dale's principle with regularisation."""

def __call__(self, A, Y, rng=None, E=None, sigma=0.):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigma shouldn't be a parameter that's passed in here. Rather, the instance should have a reg parameter, which is then used to compute sigma using the max value in A. Just like in LstsqL2.


# assert that weights themselves are close (this is true for L2 weights)

assert np.allclose(W1, W2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to check that the signs of the weights are as requested (i.e. the correct number positive/negative).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants