added initWeights method to initialize network weights