arvoelke / nengolib

Nengo library of additional extensions
Other
29 stars 6 forks source link

Orthogonal ensemble #113

Open arvoelke opened 7 years ago

arvoelke commented 7 years ago

Should figure out the best way to consolidate this with the RollingWindow use-case. This is most useful as an idea for the time-being: many nonlinear functions can be computed very accurately using orthogonal encoders by the appropriate change-of-basis (the Product network is one example). It would be great to solve for the decoders more efficiently, and have tools for experimenting with changes of basis (or even theory for finding the best basis)!

arvoelke commented 7 years ago

Possible relevant helpers:


class Axes(Distribution):

    def __repr__(self):
        return "%s" % (type(self).__name__)

    def sample(self, n, d=1, rng=np.random):
        I = np.eye(d)
        return Choice(np.vstack([I, -I])).sample(n, d)

class Radii(EvalPoints):

    def sample(self, num=1, d=None, rng=np.random):
        """Samples ``n`` points in ``d`` dimensions."""
        if d is not None:
            raise ValueError("d must be None (change num instead)")
        y = self._sample(num, rng)
        radii = np.max(np.abs(y), axis=0)
        assert radii.shape == (num,) == (self.sys.size_out,)
        return radii```