Community detection in weighted networks using probabilistic generative model