I think the primary question here is one of whether
randMatrix are reusable; the secondary question is of naming conventions.
_generateStartingWeights is not reusable, there's little reason not to write
__init__ without the layers of helpers (and that's assuming there's not some better way to use numpy for this). Oh, and if it is reusable, you can just return this from it, instead of using a locally defined helper function:
def __init__(self, layerSizes):
self.ws = [np.matrix(np.random.normal(0, 0.01, pair)) for pair in pairwise(layerSizes)]
On the flip side, if
randMatrix is reusable, it needs to be somewhere other than local to another function.
As for naming conventions, a potentially heated subject, lots of people refer to PEP-8 (which I want to clarify is not a requirement for third party code unless you want to make it one). However due to its prevelance in the Python community, there seems to be a general preference for
underscore_separated instead of
camelCase names. Since it's not even always followed in the standard library, your project's preferences can overrule it. I only bring it up since I personally find
camelCase names to be less in line with my view of "pythonic."