Inference of cosmological parameters from gravitational waves: Applications to second generation interferometers